What Is a Mosque?
Question

I would like to know what is the criterion for a mosque? So in other words what are the necessary conditions a building/room must fulfil to be considered a Masjid? And if a place does not fulfil one of such criteria but the 5 congregational prayers are made routine in such a place, is it then the same as praying in congregation at home?.
Praise be to Allah.What is a mosque?
A Masjid or mosque is a place which is prepared for the purpose of offering the five daily prayers on a permanent basis and is devoted for that purpose. 
What makes a place a mosque?
A place becomes a mosque when general permission is given to pray in it, whether it is stated clearly that it is a Waqf or endowment given for the sake of Allah, or it is not stated, according to the majority of scholars apart from the Shafa`is. (See Al-Mawsu`ah Al-Fiqhiyyah, 37/220) 
Ibn Qudamah (may Allah have mercy on him) said: 
“A Waqf is valid if it is established verbally or by means of actions which indicate that, such as if a person builds a mosque and gives the people permission to pray in it, or he establishes a graveyard and gives people permission to bury the dead in it, because that is the custom and it indicates that something is a Waqf. So it is permissible to establish it by means of that (action), as it may also be established verbally. That is like when a person presents food to his guests.” (Al-Kafi, 2/250) 
A mosque is no longer the property of the one who establishes it, because it is a Waqf, so it is not permissible for him to sell it. 
Difference between a mosque and a prayer room
There are prayer rooms (Musallas) that are set up in offices and schools ; these do not come under the rulings on mosques because they are not established as Waqfs and as such they do not cease to be the property of their owners. Moreover, the five daily prayers are not held regularly in them in most cases. 
It says in Fatawa Al-Lajnah Ad-Da’imah (5/169): What is the difference between a mosque (Masjid) and a prayer room (Musalla)? What I mean is: Is offering the prayer to greet the mosque (Tahiyat Al-Masjid) obligatory in a prayer room or does it not come under that ruling? Or is it recommended? 
They replied:
“A mosque (Masjid) is a place that has been set aside for offering the obligatory prayers on a permanent basis and is devoted for that purpose. A prayer room or prayer place (Musalla) is a place that is used for prayer occasionally, such as the `Eid prayers, funeral (Janazah) prayers and so on, and it is not set aside as a Waqf for the five daily prayers. It is not Sunnah to offer the prayer to “greet the mosque” when entering a Musalla; rather it is Sunnah to offer this prayer when entering a mosque for one who wants to sit down in the mosque; he should do it before he sits down, because the Prophet (blessings and peace of Allah be upon him) said: “When one of you enters the mosque, let him not sit down until he has prayed two Rak`ahs.” (Narrated by Al-Bukhari and Muslim) 
And Allah is the source of strength. May Allah send blessings and peace upon our Prophet Muhammad and his family and companions.” (Shaykh `Abd Al-`Aziz ibn `Abdullah ibn Baz, Shaykh `Abdullah ibn Ghadyan, Shaykh Salih Al-Fawzan; Shaykh `Abd Al-`Aziz Al Ash-Shaykh, Shaykh Bakr Abu Zayd) 
Shaykh Ibn `Uthaymin (may Allah have mercy on him) was asked about the difference between a mosque and a prayer room, and when a place may be regarded as a mosque. 
He replied: 
“With regard to the general meaning, the entire earth is a mosque because the Prophet (blessings and peace of Allah be upon him) said: “The earth has been made a place of prostration and a means of purification for me.” 
With regard to the specific meaning, a mosque is a place that has been prepared for the purpose of prayer on a permanent basis and is allocated specifically for that, whether it is built of stones, mud or cement, or not. With regard to the prayer room or prayer place, it is a place that a person uses to pray in, but he does not make it a place for prayer on a permanent basis; rather he prays there if the time for prayer comes. This is not a mosque. The evidence for that is the fact that the Messenger (blessings and peace of Allah be upon him) used to offer optional prayers in his house, and his house was not a mosque. Similarly, `Utban ibn Malik (may Allah be pleased with him) invited him (blessings and peace of Allah be upon him) to come to his house and pray in a place that `Utban could take as a prayer room or prayer place, and that place was not a mosque. So a prayer room is a place that is used for prayer without it being set up specifically as a public mosque in which the people can pray and that is known to have been set up specifically for that purpose.” (Fatawa Ash-Shaykh Ibn `Uthaymin, 12/394) 
From the above we may conclude that a mosque is a place that fulfils the following conditions: 

It has been set aside as a Waqf and is no longer the property of the one who established it
General permission to pray in it has been given, i.e., anyone who wants to pray in it is not to be prevented from doing so
It is established for the purpose of offering the five daily prayers regularly and on a permanent basis.

For more details, please see the following answers: 4448 , 145198 , 70216 , and 191668 .
And Allah knows best.