Sunan an-Nasa'i, Volume 2, Book 15, Hadith 1443 (DarusSalam)

It was narrated that Ibn 'Abbas said: "Allah, the Mighty and Sublime, enjoined the prayer on the tongue of your Prophet: While a resident four (rak'ahs), while traveling two, and at times of fear one."

أَخْبَرَنَا يَعْقُوبُ بْنُ مَاهَانَ، قَالَ حَدَّثَنَا الْقَاسِمُ بْنُ مَالِكٍ، عَنْ أَيُّوبَ بْنِ عَائِذٍ، عَنْ بُكَيْرِ بْنِ الأَخْنَسِ، عَنْ مُجَاهِدٍ، عَنِ ابْنِ عَبَّاسٍ، قَالَ إِنَّ اللَّهَ عَزَّ وَجَلَّ فَرَضَ الصَّلاَةَ عَلَى لِسَانِ نَبِيِّكُمْ صلى الله عليه وسلم فِي الْحَضَرِ أَرْبَعًا وَفِي السَّفَرِ رَكْعَتَيْنِ وَفِي الْخَوْفِ رَكْعَةً ‏.‏

sunnah.com