Maghrabi, 41, was shot by police who opened fire with a machine gun at a public square in Sana’a, Yemen.
Maghrabi was convicted of raping and killing three-year-old Rana Yahya Al-Matari.
Images released from his execution show him on the floor with his hands handcuffed behind his back.
A soldier towers over him with a machine gun aimed at his back before he fires.
The rapist’s punishment was watched by hundreds of baying spectators in the city’s main square.
al-Maghrabi was brought to the spot by police who laid him down onto a white rug.
The crowd, of mostly men, took out their mobile phones to record the event.
Television stations also broadcast his death to viewers at home.