Lionel Messi's Argentina side kept alive their bid to become the first team to retain the World Cup since Brazil in 1962 with a victory that sparked pandemonium among the sea of sky-blue-and-white supporters and ended Switzerland's fairytale run.
The Swiss had reached the World Cup quarter-finals for the first time since 1954, but fell one match short of an unprecedented semi-final appearance, suffering a major blow when Breel Embolo was sent off for diving in the 72nd minute.
The thriller - Kansas City's final World Cup game - looked headed for a shootout before Alvarez, excellent all night, whipped a gorgeous long-range shot into the top corner in the 112th minute that Gregor Kobel at full-stretch had no chance of saving.
Martinez added a third for the holders nine minutes later when he calmly slotted home the rebound of Thiago Almada's shot.
Earlier, at Miami Stadium, Jude Bellingham scored twice, including the extra-time winner, as England ground out a 2-1 victory over a battling Norway side to reach the World Cup semi-finals for the fourth time.
The teams were locked up 1-1 at the end of regulation time after Andreas Schjelderup had opened the scoring for Norway with a wonder strike in the 36th minute and Bellingham skipped into the area to equalise just before halftime.
Three minutes into extra time, though, Morgan Rogers fired a long-range shot at the Norwegian goal that Orjan Nyland could only parry and Bellingham stole in to bury the rebound, delighting the white-shirted fans in the crowd of 64,478.
