Salama b. al-Akwa' reported that the Messenger of Allah ﷺ used to pray the evening prayer when the sun had set and disappeared (behind the horizon).
أَنَّ رَسُولَ اللَّهِ ﷺ كَانَ يُصَلِّي الْمَغْرِبَ إِذَا غَرَبَتِ الشَّمْسُ وَتَوَارَتْ بِالْحِجَابِ