Sahih Bukhari Volume 007, Book 072, Hadith Number 676.

Narrated By Abu Bakra : The solar eclipse occurred while we were sitting with the Prophet He got up dragging his garment (on the ground) hurriedly till he reached the mosque The people turned (to the mosque) and he offered a two-Rak'at prayer whereupon the eclipse was over and he traced us and said, "The sun and the moon are two signs among the signs of Allah, so if you see a thing like this (eclipse) then offer the prayer and invoke Allah till He remove that state."