Some big hitting by Marterer earned him the first two games of the match.
But it did not take long for Nadal to find his range and after Marterer went long with a forehand on game point on his own serve, the Spaniard sensed his opportunity to force break point, which was secured with a double fault for 2-2.
The Spanish top seed had to recover from a service break down in both the second and third sets to see off the 70th-ranked Marterer after two hours and 30 minutes neat.
His advantage lasted all of two minutes though, as Nadal broke straight back, digging out a sliced backhand to get out of the corner and with that, it seemed Marterer's chance of an unlikely fightback was gone. He is tied 1-1 with Marterer and trails Nadal 0-5 in their previous meetings.
Periodista finge asesinato para seguir con vida
Gritsak explicó que las autoridades ucranianas captaron información sobre un complot ruso para matar a Babchenko . Lamento que hayan tenido que experimentar esto pero no había otra manera", ha afirmado el periodista ruso.
Nadal will next play 11th-seeded Diego Schwartzman, who rallied to beat Kevin Anderson 1-6, 2-6, 7-5, 7-6 (0), 6-2.
The second set was a procession for Nadal, before the German put up a good fight in the third, forcing a tiebreaker.
Marterer was only the 11th man in 50 years of professional tennis to make the last 16 on debut at Roland Garros, and first since Nadal won the first of his record 10 titles in Paris in 2005.
But Marterer, who was playing in the main draw here for the first time, moved into a 3-1 lead early in the third as he threatened to become the first man to take a set off Nadal at Roland Garros since his 2015 quarterfinal defeat by Djokovic.