It could mean either. For an Arabic speaker, there is a subtle distinction in the usage: If the name of a woman or a group is identified, then it is used in connection with lawful marriage. If the word is used in general, it can mean a number of things, one of which is sexual relation.
From this hadith in Sahih Al-Bukhari #5127 about nikah prior to Islam, one can see that the word nikah can be used as marriage alone, intercourse alone, or both.
Here it is used as marriage with a guardian (wali), with intercourse being implicit:
يَخْطُبُ الرَّجُلُ إِلَى الرَّجُلِ وَلِيَّتَهُ أَوِ ابْنَتَهُ
فَيُصْدِقُهَا ثُمَّ يَنْكِحُهَا
[...] a man used to ask somebody else for the hand of a girl under his
guardianship or for his daughter's hand, and give her Mahr and then
marry her [...]
In the context that follows, it is obvious it is referring to intercourse outside marriage (although the translation uses the word marriage):
وَنِكَاحٌ آخَرُ يَجْتَمِعُ الرَّهْطُ مَا دُونَ الْعَشَرَةِ
فَيَدْخُلُونَ عَلَى الْمَرْأَةِ كُلُّهُمْ يُصِيبُهَا
Another type of marriage was that a group of less than ten men would
assemble and enter upon a woman, and all of them would have sexual
relation with her.
In Qur'an 4:6, nikah is referring to reaching the age of puberty (the age at which one is accountable in front of Allah, and one can enter into marriage contracts)
وَابْتَلُوا الْيَتَامَى حَتَّى إِذَا بَلَغُوا النِّكَاحَ فَإِنْ
آنَسْتُمْ مِنْهُمْ رُشْدًا فَادْفَعُوا إِلَيْهِمْ أَمْوَالَهُمْ وَلَا
تَأْكُلُوهَا إِسْرَافًا وَبِدَارًا أَنْ يَكْبَرُوا وَمَنْ كَانَ
غَنِيًّا فَلْيَسْتَعْفِفْ وَمَنْ كَانَ فَقِيرًا فَلْيَأْكُلْ
بِالْمَعْرُوفِ فَإِذَا دَفَعْتُمْ إِلَيْهِمْ أَمْوَالَهُمْ
فَأَشْهِدُوا عَلَيْهِمْ وَكَفَى بِاللَّهِ حَسِيبًا
And test the orphans [in their abilities] until they reach
marriageable age. Then if you perceive in them sound judgment, release
their property to them. And do not consume it excessively and quickly,
[anticipating] that they will grow up. And whoever, [when acting as
guardian], is self-sufficient should refrain [from taking a fee]; and
whoever is poor - let him take according to what is acceptable. Then
when you release their property to them, bring witnesses upon them.
And sufficient is Allah as Accountant.
In Qur'an 33:49, the word nikah is used to refer to marriage before consummation (i.e., only as a contractual marriage with explicitly no sexual relation):
يَاأَيُّهَا الَّذِينَ آمَنُوا إِذَا نَكَحْتُمُ الْمُؤْمِنَاتِ ثُمَّ طَلَّقْتُمُوهُنَّ مِنْ قَبْلِ أَنْ تَمَسُّوهُنَّ فَمَا لَكُمْ عَلَيْهِنَّ مِنْ عِدَّةٍ تَعْتَدُّونَهَا فَمَتِّعُوهُنَّ وَسَرِّحُوهُنَّ سَرَاحًا جَمِيلًا
O You who have believed, when you marry believing women and then divorce them before you have touched them, then there is not for you any waiting period to count concerning them. So provide for them and give them a gracious release.
In Qur'an 2:237, it is again explicitly used to refer to marriage contract:
وَإِنْ طَلَّقْتُمُوهُنَّ مِنْ قَبْلِ أَنْ تَمَسُّوهُنَّ وَقَدْ فَرَضْتُمْ لَهُنَّ فَرِيضَةً فَنِصْفُ مَا فَرَضْتُمْ إِلَّا أَنْ يَعْفُونَ أَوْ يَعْفُوَ الَّذِي بِيَدِهِ عُقْدَةُ النِّكَاحِ وَأَنْ تَعْفُوا أَقْرَبُ لِلتَّقْوَى وَلَا تَنْسَوُا الْفَضْلَ بَيْنَكُمْ إِنَّ اللَّهَ بِمَا تَعْمَلُونَ بَصِيرٌ
And if you divorce them before you have touched them and you have already specified for them an obligation, then [give] half of what you specified - unless they forego the right or the one in whose hand is the marriage contract foregoes it. And to forego it is nearer to righteousness. And do not forget graciousness between you. Indeed Allah , of whatever you do, is Seeing.
The work nikah was also used in this hadith (among many others) to refer to marriage with sexual relation implicitly following:
حَدَّثَنَا مُحَمَّدُ بْنُ عَبْدِ الْمَلِكِ بْنِ أَبِي الشَّوَارِبِ،
حَدَّثَنَا أَبُو عَوَانَةَ، حَدَّثَنَا أَبُو إِسْحَاقَ
الْهَمْدَانِيُّ، عَنْ أَبِي بُرْدَةَ، عَنْ أَبِي مُوسَى، قَالَ قَالَ
رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ " لاَ نِكَاحَ إِلاَّ
بِوَلِيٍّ " .
It was narrated from Abu Musa that the Messenger of Allah said: “There
is no marriage except with a guardian.”
From a linguistic aspect, nikah means:
- Lawful marriage
- Unlawful marriage (e.g., Nikah al-Mut'aa according to Sunnis, or secret marriage not witnessed or publicly announced, or incest marriage, etc.)
- Right to exercise divorce ('isma)
- Right to terminate marriage (mostly through conditions imposed in the marriage contract)
- Sexual relation (either within the bounds of marriage, or extra-marital)
- Mixing of two things (e.g., nikah al matar indicating mixing of soil with rain water)
- Feeling sleepy (e.g., sleepiness doing nikah on one's eyes)