Roma have found form since sacking Rudi Garcia and hiring Luciano Spalletti last month, and they are now within five points of leaders Juventus.
El Shaarawy, on loan from AC Milan, curled home a brilliant opener before Ervin Zukanovic's own-goal equaliser.
But Miralem Pjanic and El Shaarawy scored to give Roma victory.
Empoli ended the game with 10 men after defender Marco Rui was sent off for two bookings.
Stephan El Shaarawy scored twice as Roma made it six Serie A wins in a row by beating Empoli to renew their title hopes.