The 29-year-old Marterer beat Lukas Klein 6-4 7-5 in the first rubber at the Hengqin International Tennis Centre in Zhuhai on Tuesday.
"I think it's a big relief for us," Marterer said. "I'm very happy with this start to the week, it makes me want more."
In extremely humid conditions, the left-hander kept his concentration and exploited the weaker serve of world No.128 Klein.
Marterer, ranked 104th in the world, managed a break in the very first game of the match and did not look back.
Hanfmann then came from behind to beat Jozef Kovalik 3-6 6-3 7-6, fending off a match point at 4-5 before prevailing.
With the overall win wrapped up, US Open runners-up Tim Pütz and Kevin Krawietz, who had only arrived the previous evening after a long journey, were under no pressure to win the final doubles match.
In addition to Slovakia, Germany face Chile and the US for one of the top two places in Group C.
The two best teams in the group will advance to the final round in Malaga, Spain, in November.
The fact the International Tennis Federation (ITF) placed European teams in a group in China has been heavily criticised.
"I think the teams that are here now all agree that it's nonsense to play here," Germany team manager Michael Kohlmann said.
On Thursday, the team face a strong-looking Chile.
"We've all prepared very well," Marterer said. "We feel comfortable with the conditions. I think there could be a little surprise."