Firefighters, unable to pull the baby out, ended up sawing away an L-shaped section of the pipe and carrying it to a hospital, where it was delicately pried apart to save the infant.
Video of the two-hour rescue of Baby No. 59 - so named because of his incubator number in the hospital in the Pujiang area of the city of Jinhua - was shown on Chinese news programs and websites late Monday and Tuesday.
The baby, who weighed 2.8 kilograms (6 pounds, 2.8 ounces), had a low heart rate and some minor abrasions on his head and limbs, but was mostly unhurt, according to Zhejiang Online, the province's official news site. The placenta was still attached.
It was unclear how the baby ended up in the toilet, but police said they were treating the case as an attempted homicide. The Pujiang county police bureau said on its official microblog account that the boy's mother has been located and that an investigation was under way, but it gave no further details.
In the video, officials were shown removing the pipe from a ceiling that apparently was just below the restroom and then, at the hospital, using pliers and saws to gently pull apart the pipe, which was about 10 centimeters (about 3 inches) in diameter.
News of the baby's ordeal was met with horror and pity by bloggers on Chinese sites. Most speculated that the child had been dumped by his parents down the toilet.
The rescue prompted an outpouring from strangers who came to the hospital with diapers, baby clothes, powdered milk and offers to adopt him.
The landlord of the building told Zhejiang News that there were no signs that the birth took place in the restroom and she was not aware of any recent pregnancies among her tenants.
Despite the offers to adopt Baby No. 59, a doctor at the hospital said the boy would be turned over to social services if his parents did not claim him, Zhejiang News said.
In China, reports of babies being abandoned are common and fuel public anger against a strict one-child policy that imposes huge fines on parents who violate the rules. The policy has been blamed as a factor in causing parents to abandon unwanted children, although they are usually baby girls because of a traditional preference for males.