Media playback is not supported on this device
Di Maria fired in Messi's pass to clinch a 1-0 win, ending stubborn Swiss resistance and setting up a quarter-final tie against Belgium.
"I was nervous towards the end because we couldn't score and any mistake could have knocked us out," said Messi, 27.
"The minutes were passing and we didn't want the match to go to penalties."
Two-time champions Argentina dominated possession in Tuesday's last-16 tie against the Swiss but were unable to break through until Di Maria scored in the 118th minute.
"We were suffering but had a special play," added Argentina captain Messi, Barcelona's four-time World Player of the Year.
Switzerland defender Blerim Dzemaili headed against the Argentina post then prodded wide after Di Maria's strike.
But Real Madrid winger Di Maria said victory was "more than deserved".
"It wasn't me, the heroes are 23 players and the technical staff," the 26-year-old added. "We gave our lives, our souls."
Media playback is not supported on this device
Argentina had 29 shots over the 120 minutes, while the Swiss did not manage an effort on target after the 50th minute.
But Ottmar Hitzfeld's side created the best chances of the first half.
Argentina keeper Sergio Romero saved in quick succession from Granit Xhaka and Stephan Lichtsteiner, before denying Josip Drmic shortly afterwards.
"It was a game that we deserved to win in 90 minutes," said Argentina coach Alejandro Sabella.
"It was even during a first half in which they had two clear chances to score, but in the second half we were clearly superior. We had five or six shots at goal and, in extra time, we also had more chances."
Defeat marked the end of Hitzfeld's 31-year managerial career.
The 65-year-old German is a two-time World Coach of the Year who won 19 major club trophies for Bayern Munich, Borussia Dortmund and Grasshoppers, before taking charge of the Swiss national team in 2008.
"I have a quiet life in front of me," he said.
"I was very fortunate to coach some marvellous clubs and the Swiss national team. It has been a great honour and I am proud to say goodbye to the Swiss team with my heart full of emotions."
Lionel Messi said he feared Argentina would be knocked out of the World Cup before he set up Angel Di Maria's late extra-time winner against Switzerland.