Lionel Messi avoided another disappointment with the national team as Argentina escaped elimination in the group stage of the Copa America.
Lautaro Martinez and Sergio Aguero scored a goal in each half as Argentina defeated guest team Qatar 2-0 to secure a spot in the quarterfinals of the South American competition.
"We needed a victory to give us confidence and tranquility," Messi said. "What I liked the most was the team's attitude, its desire to win the game."
Argentina finished second in Group B behind Colombia, which did Argentina a huge favor by beating Paraguay 1-0 in the other group match on Sunday.
Colombia finished with nine points, Argentina four, Paraguay two and Qatar one.
The top two teams in each of the three groups advance, along with the two best third-place finishers. Paraguay will advance only if Japan and Ecuador draw on Monday in Group C.
Argentina, which hasn't been eliminated in the first round of the South American tournament since 1983, will face Venezuela in the quarterfinals at the Maracana Stadium in Rio de Janeiro.
It was Argentina's first win at this year's Copa America after opening with a 2-0 loss to Colombia and a 1-1 draw with Paraguay.
Argentina struggled again on Sunday, unable to impose its game against the Asian champion. Messi again was far from his best, unable to spark his team into a dominant performance.
Martinez opened the scoring only four minutes into the match after a mistake by Qatari defender Bassam Al Rawi while trying to pass to a teammate in front of his area. Martinez intercepted the pass and found the net to open the scoring at the Arena Gremio.
Qatar, making its first appearance as a guest in the Copa America, stayed in contention during most of the match but Aguero sealed Argentina's win with a run past a couple of defenders in the 82nd.
"The pressure was there," Argentina coach Lionel Scaloni said. "Luckily we got an early goal."
Argentina's last title with the senior team was the 1993 Copa America. It has come close to victory in recent years with Messi, losing in the final in the World Cup in 2014 and in the Copa America in 2015 and 2016.
Argentina entered the match last in the group, knowing only a victory would guarantee its place in the next round. Qatar, led by Spanish coach Felix Sanchez, was making its first appearance as a guest in the Copa America, hoping to gain experience for when it hosts the 2022 World Cup. It was eliminated despite opening with a gritty 2-2 draw against Paraguay and a late loss to Colombia.
Qatar will also play in next year's Copa America co-hosted by Colombia and Argentina.
Venezuela, Argentina's next opponent, was second to Brazil in Group A. It drew 0-0 with the hosts in its second game in the Copa America.
"It will be a difficult opponent," said Scaloni, whose team lost 3-1 to Venezuela in a friendly in Madrid in March. "It's an interesting team, it has been playing together for a long time."