Argentina took the lead after three minutes when an atrocious pass out of defence went straight to Martinez, who made no mistake from 15 meters out.
The first half was an even affair with Martinez and Aguero missing good chances for Argentina and Bassam Alrawi clipping the post from a free kick for the Asian champions.
But even with Lionel Messi looking more spritely than in Argentina’s first two games, it took them until the second half before they were able to seal the points.
With eight minutes remaining Aguero ran on to a through ball and angled a fine drive past the Qatari keeper.
“When we scored the first goal we just needed to keep our calm until the end and we were qualified,” Martinez said. “We were playing a good team, we couldn’t make a mess of it.”
Argentina’s win, their first after a loss to Colombia and a draw with Paraguay, leaves them in second place in Group B on four points behind group winners Colombia, who beat Paraguay 1-0.
They will now play Venezuela in Rio de Janeiro on Friday, while the other quarter-final ties will only be decided after Monday’s final Group C matches.
“Now we need to stay focused and win the next game and keep progressing,” Martinez said.
The top two teams in each group qualify for the knockout stage along with the two best third-placed sides.
Brazil and Venezuela qualified from Group A on Saturday and third place Peru will join them.
Group C will be decided on Monday when Chile play Uruguay and Ecuador take on Japan.