Alcaraz and Medvedev cruise into second round of China Open
The two men struggled to hold serve early on but Alcaraz notched the crucial break and secured the first set with a blistering ace.
The Spaniard found his rhythm in the second, breaking Hanfmann in game three and taking the match when Hanfmann slammed a forehand return into the net.
The Wimbledon champion will face Italy's Lorenzo Musetti in the second round.
Earlier, world number three Daniil Medvedev cruised through with a 6-2, 6-1 victory over Tommy Paul.
The Russian broke serve decisively in the fourth game and secured the opening set when Paul lofted a forehand long.
Medvedev then peppered the American with a barrage of powerful serves and forehands to close out the match with ease.
He will play Alex De Minaur in the second round after the Australian edged out Britain's Andy Murray in a third-set tie-break on Thursday.
"During the match, I played better and better," Medvedev said at a post-match press conference.
"I managed to serve better, to find better angles, some good returns, some good depth on my shots," the US Open runner-up said.
"It's never easy after a Grand Slam final to come back and play a big tournament, so (I'm) happy with it."
World number four Holger Rune downed Canada's Felix Auger-Aliassime 6-4, 6-4 on Friday to set up a second-round tie with Bulgarian Grigor Dimitrov.
But Greek heavyweight Stefanos Tsitsipas slumped to a 6-4, 6-4 defeat against Chilean Nicolas Jarry, ranked at number 23 in the world.
This year's China Open is the first since 2019 after Beijing ditched its isolationist zero-Covid policy.
All of the eight top-ranked men are in action except world number one Novak Djokovic.