Milan win eases pressure on Allegri
Remarkably, El Shaarawy's opener was the Rossoneri's first goal at the San Siro this season and his classy second strike sealed a first victory in front of the home faithful.
Cagliari enjoyed dominant spells but were made to pay for Mauricio Pinilla's profligacy, never really recovering from Daniele Conti's dismissal for an altercation with Giampaolo Pazzini.
El Shaarawy was first to fire a warning shot across the bows, dancing into Cagliari's penalty area only to let the ball run into the gloves of a grateful Michael Agazzi.
Conti and Victor Ibarbo then combined to send Pinilla through at the other end, the Chilean fluffing the chance before El Shaarawy inspired rapture among the home fans in the 15th minute.
The striker latched on to a defense-splitting pass from Riccardo Montolivo to spring the offside trap and slot the ball past a stranded Agazzi.
Pazzini, making his 250th appearance in Serie A, flashed a shot wide as Milan pushed for a second goal.
Ibarbo muscled his way into a shooting position at the other end, coolly controlling the ball but lashing it just wide of Abbiati's post.
But Milan should have doubled their lead just before the break.
El Shaarawy rifled Urby Emanuelson's corner against the crossbar with a quick-thinking Davide Astori cutting out Pazzini's header from the rebound.
Cagliari's players started the second half brightly, but Pinilla headed over two promising chances and skewed an even better opportunity wide from 15 yards.
Nevertheless, the visitors continued to press and Ibarbo nodded Conti's free-kick agonizingly wide of a post in the 62nd minute.
But Conti saw red for two moments of madness, first poking Pazzini's cheek in a tussle on the halfway line, before elbowing the Milan man to earn two rapid yellow cards and his marching orders.
Substitute Massimo Ambrosini belied his 35 years to inject fresh life into Milan's attack and the veteran midfielder played a crucial role in El Shaarawy's second goal.
The home crowd were in full voice as the young striker seized on Ambrosini's neat pass to clip beyond Agazzi's reach once again.
Abbiati had to scramble across his goal to keep out substitute Nene's swerving strike but Milan had delivered a long-awaited home victory.