Carlo Ancelotti's side were sloppy in possession and lethargic in the early stages but improved as the half wore on with Gylfi Sigurdsson's free-kick forcing Dean Henderson into a fine save.
The Toffees were dealt a blow early in the second half when Richarlison was forced off after being sandwiched between Bruno Fernandes and Eric Bailly when challenging for a header.
The second half was a tetchy and disjointed affair but Cavani, who was lucky to escape a card after a coming together with Yerry Mina, stole the show with a stunning curling shot from the edge of the box.
Everton's Portuguese midfielder Andre Gomes (L) controls the ball in front of Manchester United's Uruguayan striker Edinson Cavani
Image credit: Getty Images
And substitute Anthony Martial, who set up the opener, netted from a counter attack with the last kick of the game to seal victory.
TALKING POINT - Should Cavani have been sent off?
The Uruguay striker got involved with Mina in the second half and appeared to grab hold of the Colombian for a prolonged period before shoving him to the ground. It was not a WWE-style chokeslam but Cavani appeared to touch his throat. Referee Andy Madley did not take any action - where is VAR when you need it?
MAN OF THE MATCH - Edinson Cavani (Manchester United)
At 33 years old he is showing no signs of slowing down after another vital late goal for United. He began the game brightly, faded in the second half but relied on his class in a clutch moment with a world class finish in the 88th minute.