The Paris Saint-Germain striker had already bagged a brace in the contest, putting Uruguay up 2-1, but was unable to continue in the 74th minute as he limped off the field with the assistance of Cristiano Ronaldo.
Cavani signalled he was unable to continue and was immediately replaced by Cristhian Stuani.
The forward had been instrumental in his side's performance to that point, having opened the scoring in the seventh minute after making an excellently timed run to get on the end of a cross into the area by fellow forward Luis Suarez.
Then, after Pepe had drawn Portugal level from a corner kick, Cavani turned on the magic once more.
After getting played into space at the edge of the area by Rodrigo Bentancur, Cavani delivered a curling drive from just inside the area that bent around Rui Patricio and into the net, scoring what ultimately proved the winner for the South American side.
It was his third goal of the tournament, having opened his account in Russia with a goal against the hosts in the final group stage game as Uruguay claimed a 3-0 victory.
However, 10 minutes later, Cavani was done, limping off in obvious pain. He required assistance to make it off the field, provided by Ronaldo, who aided his opponent all the way to the touchline.
"I hope it's nothing," Cavani said post-match. "We'll see what happens, we'll do exams. I felt pain and could not continue on the pitch."
Despite the injury, the PSG star was overjoyed with the result.
"It's very exciting. I have no words to describe this," he told A Bola.
"I am happy, happy, happy. I wonder how people are in Uruguay. Let's continue to dream."
Thanks to Cavani's brace, Uruguay advanced to the quarter-final on July 6 against France, meaning he will have six days to get fit for that clash at the Nizhny Novgorod Stadium.