Assalamualaikum ustaz. What is the status of a prayer performed with a slightly deviated qibla of several degrees (if it is according to the minute needle if it should be at 12, it slightly deviates to 12.05)?
Alhamdulillah, praise and gratitude to Allah SWT for His countless blessings for us all. Praise and salutations to our beloved Prophet Muhammad PBUH, his family, companions and all those who follow his footsteps until the Last Day.
Definition of Qibla
Lexically, qibla means direction (al-jihah) where we pray facing it and according to the syara’ terminology, it can be understood as the Kaaba and nothing else. 
There is no khilaf amongst the fuqaha’ which states facing the Kaaba is one of the valid conditions of prayer for those who are capable to do so. 
Facing the Qibla as Prayer’s Valid Condition
According to the evidence presented in al-Fiqh al-Manhaji, it is stated: “What is meant by the qibla is the Kaaba meaning the Kaaba must be in front of him. The evidence for this condition is the statement of Allah SWT:
وَمِنْ حَيْثُ خَرَجْتَ فَوَلِّ وَجْهَكَ شَطْرَ الْمَسْجِدِ الْحَرَامِ ۚ وَحَيْثُ مَا كُنتُمْ فَوَلُّوا وُجُوهَكُمْ شَطْرَهُ
“And from wherever you go out [for prayer], turn your face toward al-Masjid al-Haram. And wherever you [believers] may be, turn your faces toward it,” 
Likewise, in a hadith, Rasullullah PBUH was teaching a person how to pray, where he said:
إِذَا قُمْتَ إِلَى الصَّلاَةِ فَأَسْبِغِ الْوُضُوءَ، ثُمَّ اسْتَقْبِلِ الْقِبْلَةَ فَكَبِّرْ
“When you get up to pray, perform the ablution completely, and then turn towards the Qibla and recite takbir (Allah o Akbar = Allah is the Most-Great).” 
The meaning of Masjid al-haram in the verse means the qibla in the hadith which is the Kaaba. A person who prays whether he is near of which he can look at the Kaaba if he so wishes or far where it is impossible for him to see it. A person who is near the Kaaba, it is obligatory to face the Kaaba with certainty while a person who is far from Kaaba it is obligatory to face it with strong guides if there isn’t a certain and absolute guide.” 
Facing the Kaaba means his chest is facing the Kaaba, not with his head for a person who is praying whilst standing and sitting; with the head and chest for a person who is praying whilst lying on his side; and with his head and toes for a person praying on his supine. 
For those who are far away from the Kaaba or those who are hindered from seeing the Kaaba directly, the prayer isn’t affected if the position is slight to the right or left from the Kaaba itself, as long as it hasn’t deviated away from the direction of the Kaaba. 
In madhhab al-Syafie, the methodologies to determine the qibla is by following the 4 orders of prioritizations, which are:
- One’s own certain knowledge, such a s a person who can see the Kaaba himself or a blind person who can touch the Kaaba.
- News or information from a trusted person.
- Ijtihad, such as by using compass or others.
- A person who taqlid with the ijtihad of someone else. 
The Status of a Prayer Performed with a Slightly Deviated Qibla
According to the above explanation and facts, we are inclined to state that the qibla which is slightly deviated to the right as stated doesn’t affect the validity of prayer.
However, in our opinion, the best approach is to employ the Falak Unit service from the state Mufti Department Office where one is at. The reason is determining the qibla using a compass may have a slight difference compared to the qibla determination method of looking at the direction of the sun using more accurate modern equipment.
What’s certain is with the determination of qibla by the Falak Unit and certificate issue, the doubts and controversy that happens will get resolved and congregants are able to pray calmly and with khusyuk.
 See Mughni al-Muhtaj, 1/142
 See al-Mausu’ah al-Fiqhiyyah al-Kuwaitiyyah, 32/302
 Narrated by al-Bukhari (5897) and Muslim (397)
 See al-Fiqh al-Manhaji, 1/127-128
 See Kasyifah al-Saja, pg. 197; al-Taqrirat al-Sadidah, pg.200
 See al-Mu`tamad fi al-Fiqh al-Syafie, 1/217
 See I`anah al-Talibin, 1/145