Despite dominating possession, La Albiceleste failed to extend their advantage as Switzerland held firm through the remainder of the first half.
The Swiss found an equalizer in the 67th minute when Nottingham Forest winger Dan Ndoye finished a neat one-two with Ricardo Rodríguez, forcing the match into extra time.
Argentina eventually broke through as Julián Alvarez produced a moment of brilliance, curling a spectacular strike into the top corner to restore his side's lead in extra time. The Atlético Madrid forward's goal is already being hailed as one of the tournament's best.
Tensions flared shortly after, with José López receiving a yellow card following an animated celebration after providing the assist.
Lautaro Martínez sealed the victory just before the final whistle, capitalizing on a loose ball to make it 3-1 and send Switzerland out of the tournament.
Messi finished with another assist, bringing his tally to 10 goal contributions in the World Cup, including his fourth assist, leaving him just one behind tournament assist leader Michael Olise of France.
Argentina now advance to the semifinals, where they will face England in a blockbuster showdown.