Uruguay – defending Copa America champions after victory in 2011 – were once again without Barcelona star Luis Suarez, still banned from competitive international duty following his bite on Italy's Giorgio Chiellini at the World Cup, and they had to withstand sustained Morocco pressure in the first half.
Karim El Ahmadi and Nordin Amrabat both went close for the hosts before Abderrazak Hamdallah hit the post on the stroke of half-time.
But it was the visitors who took the advantage from the penalty spot in the 51st minute after Diego Rolan had been fouled by Nabil Dirar.
Morocco pushed hard late on for an equaliser, and Medhi Benatia spurned a gilt-edged chance to level, but Cavani's strike proved enough.
Despite the absence of Suarez – who will also miss the entirety of this year’s Copa America as he continues to serve his suspension – Tabarez's side went into the game having won all but two of their friendlies since the World Cup.
However, they struggled early on in Agadir, with Cavani largely anonymous up front as the hosts, coming into the clash on the back of six consecutive victories, began well.
Badou Zaki's side went closest to opening the scoring when former Aston Villa midfielder El Ahmadi's long-range drive flew just wide.
Amrabat squandered a golden opportunity soon afterwards, when, following a swift counter-attacking move, he was played through by Omar El Kaddouri, but the Malaga man could only poke his effort wide under pressure from Fernando Muslera.
The visitors did manage to gain a foothold in the game as the half wore on, but they were still lucky to go in at the interval level when Hamdallah's neat near-post flick clipped the right-hand upright.
Uruguay started the second half reinvigorated, and they were rewarded for their efforts when referee Diedhiou Malang deemed that Dirar had pulled the shirt of Rolan as the striker bore down on goal.
Cavani made no mistake from the resulting penalty, dispatching it powerfully into the left-hand corner and sending debutant goalkeeper Munir Mohand Mohamedi the wrong way.
Muslera almost gifted Morocco an equaliser just after the hour mark, spilling El Kaddouri's curling effort at the feet of Benatia, but the Bayern Munich defender failed to convert the rebound.
Cavani could have doubled his tally with 15 minutes remaining, but the PSG striker was unable to connect with substitute Alvaro Gonzalez's whipped cross.
Muslera then pulled off a superb point-blank save to deny Zakaira Labyad, before fellow substitute Mouhssine Lajour went close with a powerful header but Uruguay's defence – organised excellently by Atletico Madrid's Diego Godin – remained solid.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.