If anyone says a rak'ah of the 'Asr prayer before sunset, he has observed (the 'Asr prayer), and if anyone performs a rak'ah of the Fajr prayer, he has observed (the Fajr prayer). (Using translation from Abū Dāʾūd 412)
مَنْ أَدْرَكَ مِنَ الْعَصْرِ رَكْعَةً قَبْلَ أَنْ تَغْرُبَ الشَّمْسُ فَقَدْ أَدْرَكَهَا يُرْوَى ذَلِكَ عَنِ ابْنِ عَبَّاسٍ عَنْ أَبِي هُرَيْرَةَ عَنِ النَّبِيِّ ﷺ وَمَنْ أَدْرَكَ مِنَ الْفَجْرِ رَكْعَةً قَبْلَ أَنْ تَطْلُعَ الشَّمْسُ فَقَدْ أَدْرَكَهَا