The Frenchman broke Nadal on the way to taking the first set 6-4, and the world No. 23 came within a whisker of sealing an upset when the second set went to a tiebreak.
But Nadal, 31, with the Beijing crowd backing him on the outdoor hard court, held his nerve when twice staring defeat in the face and fought back to win the tiebreak 8-6.
The pair headed into a final-set shootout and again Pouille refused to buckle, Nadal getting the critical break of serve in the 11th game before serving for the set and match 7-5.
Nadal, a 16-time Grand Slam champion, tumbled and lost a shoe at one point, and said afterwards he was fortunate to be in the second round.
“He played well, I think, very aggressive. He’s serving well,” said Nadal, who lost to Pouille the last time they met, at last year’s US Open.
“For me it was a little bit difficult at the beginning, then I started to play better.
“But still, I didn’t have the control of the match for almost all the time.
“I am very, very happy to be through.”
— Tennis TV (@TennisTV) October 3, 2017
Nadal narrowly avoided the fate of fellow Spaniard and top-ranked Garbine Muguruza, who exited in the first round on Monday when she retired from her match with a virus.
Also into the second round in the men’s draw are Nick Kyrgios, Juan Martin del Potro, the American John Isner and third seed Grigor Dimitrov of Bulgaria.
The Russian former number one, on the comeback trail since April following the ban for taking the banned substance meldonium, had to dig deep as she defeated compatriot Ekaterina Makarova in three sets.
Sharapova, a lowly 104 in the world and on a wildcard at the China Open, has yet to win a tournament since returning to tennis.
The five-time Grand Slam champion said she had endured “a few ups and downs” in seeing off Makarova 6-4, 4-6, 6-1.
But the 30-year-old is relishing her showdown with the Romanian Halep: “We know each other’s games very well, that’s no secret.
“They’ve always been very challenging, tough, competitive, emotional.”
Sharapova, a crowd favourite in Beijing, added: “But I love the challenge of playing against someone that’s number two in the world.
“She’s a great player, she’s had a great year.
“Any time you’re able to face an opponent that’s done something right and well, it’s great to see where you are and where your level is.”
The Halep meeting will be a replay of the first-round match between the pair at the US Open in August, when Sharapova made an impressive return to Grand Slam competition before exiting in the fourth round.
Sharapova boasts a 7-0 record against Halep, who made it into the next round after Magdalena Rybarikova retired ill in the second set.
Karolina Pliskova, the fourth seed from the Czech Republic, booked her spot in round three with a 6-4, 6-4 victory over Andrea Petkovic of Germany.
Know more about Sport360 Application