The world No. 1 was not as dominant as in his first-round win over Victor Estrella Burgos but that had a lot to do with the performance of Argentinian Mayer, who refused to allow Nadal to pull away, the Guardian reported.
There was no real question of Mayer threatening an upset, as he had briefly at the US Open last summer when he won the first set of their third-round clash before Nadal’s game clicked into gear.
But he showed good resistance to break the Nadal serve when the Spaniard served for the match before going down 6-3, 6-4, 7-6 (4).
Nadal said, “It’s an important victory for me, a tough opponent. Leonardo is a player with big potential, he hits the ball so strong. I had to hit some great shots in the tie-break.
"I'm happy to be in the third round and a second victory in a row is very important news for me," added Nadal.
"Leonardo is a player with big potential, he hits the ball so strong. He is a very dangerous opponent.
"This tournament is my favorite of the year, so I want to stay here as long as possible."
In the last 32, Nadal will face 28th seed Damir Dzumhur from Bosnia, who defeated Australian John Millman 7-5, 3-6, 6-4, 6-1.
Also on Wednesday, third seed Grigor Dimitrov was pushed to the limit before scraping past American qualifier Mackenzie McDonald in the second round.
The Bulgarian, whose form has made him one of the favorites for the title, eventually came through 4-6, 6-2, 6-4, 0-6, 8-6 after three hours and 25 minutes, BBC reported.
Dimitrov struggled from the start as world number 186 McDonald played the match of his career.
But the 26-year-old held his nerve to seal victory in a tense final set.
"He deserves a lot of credit. He played an unbelievable game," said Dimitrov.
"I had to fight so much and in the end I think my experience helped me.
"I'm so happy with the result and the fight."
McDonald only recorded his first Tour-level victory in the first round but was not daunted by playing on a packed Rod Laver Arena in the first match of the night session.
His powerful serve and aggressive tactics helped him take the first set as Dimitrov began slowly.
The Bulgarian, who won the season-ending ATP Finals in London, seemed to have regained control in the second and third sets but McDonald came back in spectacular fashion to take the match to a final set.
Dimitrov had to hope for McDonald to falter under the lights and finally the American double-faulted to give him match point.
McDonald hit a forehand into the net to ensure Dimitrov's place in the third round and a clash with Russian 30th seed Andrey Rublev.
‘Football’s making more’
Meanwhile, Nadal does not want to be drawn into the debate over whether players should break away to form their own union but is in favor of pushing for lower-ranked professionals to be paid a greater share of the sport’s revenues.
“One sport is bigger when not only the top guys win a lot of money,” Nadal said.
“It's bigger when a sport creates a lot of jobs. If there are 300 people living from tennis it is better than if there are only 100.”
Nadal’s comments followed reports that Novak Djokovic, the President of the Association of Tennis Professionals’ Player Council, had talked at a players’ meeting last week about forming a breakaway union, which would be in a stronger position to push for more prize money from the Grand Slam events in particular.
Djokovic, nevertheless, insisted subsequently that much of what had been written was incorrect and denied that he had raised the subject of a possible future boycott of the Australian Open by players.
Nadal said, “I don’t know 100 percent about what’s going on or not, but at some point, it's good that the players speak between each other about what we want or what we don’t want.”
Nadal rejected comparisons with other sports like football, in which thousands of players around the world make a living.
“The market is the market,” Nadal said. “Probably our sport is more global than football, but at the same time football is much bigger than tennis in terms of money, in terms of millions of fans.”