El Shaarway gave Roma the lead just 15 minutes with the first chance of the contest followed by chances from Miralem Pjanic and Radja Nainggolan but couldn't double their sides lead.
Lucas Digne had a good opportunity at the beginning of the second period but substitute Dzeko added a second just after the hour mark.
Lazio sprung into life after the second goal with chances from Wesley Hoedt and Vitaliy Mandziuk before he halved the deficit but late goals from Florenzi and Perotti sealed the three points.
It was a quiet start to what is usually a fiery atmosphere at Stadio Olimpico but Roma still managed to take the lead with the first real opportunity of the game.
It was a poor defensive display from Lazio as El Shaarawy was left unmarked and he rose highest to Digne's great ball into area and his header gave Federico Marchetti no chance.
The game began to open up after the opening with Luciano Spalletti's side having a handful of opportunities but Lazio felt that they should have had penalty when Felipe Anderson was impeded by Antonio Rudiger but referee Luca Banti waved away the appeals.
Pjanic thought he added a second five minutes from the break after he received the ball from Nainggolan after the Belgian did brilliantly to win the ball back. The Bosnian's curling effort had Marchetti rooted to his goalline but the effort came back off the post.
Nainngolan then had his own opportunity on the stroke of half-time as he made a great run along the edge of the penalty area but seemed to do too much as his strike curled beyond the top corner and wide.
Digne showed great initiative at the beginning of the second period as he looked to catch out Marchetti and almost did at the near post, but the 'keeper managed to get across just in time to spare his blushes.
The Italian could do nothing to prevent the visiting side doubling their lead in the 63rd minute. Nainggolan showed great determination to get the ball to Perotti whose effort from distance clattered off the post but Dzeko kept his cool to slot it into a empty net.
Burst into life
Pioli's side burst into the life after the Bosnian's strike and had great opportunities to get themselves back into the contest.
The first came in the 67th minute when a wayward header from the corner found it's way to Hoedt who turned it towards goal but he could only find the post.
Another dangerous corner followed moments later as Mandziuk's header looked certain to find the back of the net but Wojciech Szczesny did brilliantly with the one-handed stop to tip it onto the crossbar.
The Pole's heroics were instantly wiped away as he was majorly at fault as Lazio found themselves back in the game.
The Arsenal loanee came flying off his line to claim Balde Keita's cross but got nowhere near as Miroslav Klose headed it back across the area and Mandziuk, who was denied moments earlier, was on hand to tap into a empty net.
Seal the win
Despite the momentum been in the favour of the home side, Roma reinstated their two-goal cushion and effectively ended the contest with eight minutes to play.
It would be one to remember for Rome-born Florenzi as the corner came back out to him on the edge of the area and added another spectacular goal to his growing list as he sweetly placed it into the bottom corner.
The three points were sealed with four minutes to play as Perotti did well to win possession and ran on goal and with no pressure on him he took his time to coolly place his shot into the same corner as his captain to seal the win.
A miserable afternoon was sealed fro the home side as they were reduced to ten men in injury as a silly challenge on Florenzi saw Hoedt receive his marching orders.