Will a person attain the reward of being in the first row even if there is only one row in the mosque?
Firstly:
The evidence indicates that the reward for praying in congregation increases with the number of worshippers. We have explained that in the answer to question no. 38194.
The reward for the steps that you take to the mosque, no matter how far away it is, is recorded for you with Allaah, as the Prophet (peace and blessings of Allaah be upon him) said: “Every step that is taken towards prayer is a charity.” Narrated by al-Bukhaari, 2989; Muslim, 1009.
Muslim (665) narrated that Jaabir ibn ‘Abd-Allaah (may Allaah be pleased with him) said: Some land near the mosque became vacant, and Banu Salimah wanted to move there and be close to the mosque. News of that reached the Messenger of Allaah (peace and blessings of Allaah be upon him) and he said to them, “I have heard that you want to move near the mosque.” They said, “Yes, O Messenger of Allaah, we want to do that.” He said, “O Banu Salimah, stay where you are, for your steps are recorded; stay where you are, for your steps are recorded.”
Al-Nawawi (may Allaah have mercy on him) said: What this means is stay where you are, for your steps will be recorded and the many steps that you take to the mosque will be recorded for you. Banu Salimah was a well-known tribe of the Ansaar. End quote from Sharh Muslim, 5/169.
It should be noted that the criteria for deciding whether to pray in one mosque or another includes other matters besides the number of worshippers and the number of steps taken to reach the mosque, such as whether the imam and congregation adhere to the Sunnah, how keen they are to establish prayer as enjoined by Allaah, with proper focus and humility, straightening the rows and other things that make the prayer more complete and perfect. In some mosques there may be circles for teaching or memorizing the Book of Allaah, so a person should have a share of that and should not miss out on such things, even if the number of the people in the mosque is small.
Proper understanding dictates that one should weigh up the quality of one's deeds and prioritize accordingly, and strive to attain reward as much as possible.
Secondly:
There are several ahaadeeth about the virtue of the first row, such as that narrated by al-Bukhaari (615) and Muslim (437) from Abu Hurayrah (may Allaah be pleased with him), according to which the Messenger of Allaah (peace and blessings of Allaah be upon him) said: “If the people knew what (reward) there is in the call and the first row, and there was no other way to settle the matter than drawing lots, they would draw lots for it.”
Abu Dawood (664) and al-Nasaa’i (811) narrated that al-Bara’ ibn ‘Aazib said: The Messenger of Allaah (peace and blessings of Allaah be upon him) used to walk up and down the rows, wiping our shoulders and chests, and he would say, “Do not let your rows be ragged lest this create disharmony in your hearts”, and he used to say, “Allaah and the angels send blessings on the front rows.” Classed as saheeh by al-Albaani in Saheeh al-Nasaa’i.
This was also narrated by Ibn Maajah (997) with the wording: “Allaah and the angels send blessings upon the first row.”
What is meant by the first row is that which is directly behind the imam, whether there is a barrier or not. And it was said that it is the first complete row that is directly behind the imam, or it means those who came to the prayer first, even if they pray in the back rows.
Al-Nawawi (may Allaah have mercy on him) said: The first view is the one that is sound. This was stated by the scholars. The other two views are clearly mistaken.
End quote from Fath al-Baari, 2/244.
It makes no difference whether there is one row or several rows in the mosque. The row that is closest to the imam is the first row, and its people are promised reward as indicated by the general meaning of the ahaadeeth.
And Allaah knows best.