The visitors appeared to have wasted their opportunity after flying out of the blocks in the first half, much as they did in demolishing Leeds on Sunday, but on this occasion the goals did not flow.
However, once Everton had weathered the storm the game appeared to be meandering towards penalties until Uruguay international Cavani, who had been lively all night, produced a clinical, angled strike from the edge of the penalty area in the 88th minute.
What made it worse was the striker was probably lucky to still be on the pitch after raising his hands in a second-half altercation with Yerry Mina.
Substitute Martial made sure of a 16th semi-final appearance in the competition with the last kick of the match as Everton chased an equaliser.
Nine changes – only captain Harry Maguire and playmaker Bruno Fernandes retained their places – did not appear to disrupt United's flow as they overwhelmed an in-form Everton.
That meant for the first time United fielded played Donny Van De Beek, Paul Pogba and Fernandes in the same team but it looked like a tactic which would bring dividends as the home side barely had a kick in the opening half-hour.
If they were not panicking in possession they were hanging on by their fingernails as United started with the same tempo which had seen them hammer Leeds with a devastating early salvo.
It was very much out of character for a side which had conceded just once in racking up three successive victories but it highlighted just how good United were.
Manager Ole Gunnar Solskjaer had said they were "desperate" to end a trophy drought stretching back to 2017 and their early play showed that desire.
At times it appeared they were operating with three number 10s as Van De Beek, Fernandes and Mason Greenwood all rotated positions in the space just outside the penalty area with Cavani given licence to roam where he liked.
Cavani was denied three times by Robin Olsen, with the Swede pulling off a smart double-save having earlier almost made Carlo Ancelotti regret his decision to rest Jordan Pickford as his mis-control almost handed a goal to the forward.
Greenwood's stooping header grazed the base of the far post as United swarmed all over their hosts, doing everything but score.
Somehow Everton weathered the storm and Gylfi Sigurdsson forced Dean Henderson to claw away his free-kick in the latter stages of the half as the hosts went in at half-time with the feeling they had a lucky escape.
There was a fiery start to the second half with Cavani appearing to grab Mina by the throat as they tussled in the centre-circle, for which referee Andrew Madley took no action with VAR only available from the semi-final stages.
Then Everton's medical staff had to physically intervene with Richarlison on the touchline, insisting concussion protocols must be followed, as the forward was determined to return to the action despite seeming to take a heavy blow to the head after being sandwiched by Eric Bailly and Fernandes.
Solskjaer's decision to make so many changes meant he was able to call on Marcus Rashford and Martial for the final 25 minutes.
Everton narrowed their back four and put substitute Tom Davies on Fernandes as that appeared to have stemmed the flow but with a shoot-out imminent, a moment of quality from Cavani changed everything and Martial's goal rubbed salt in the wound.