The change, which was announced in October by the ruling Communist Party, takes effect from January 1, the Xinhua news agency reported.
All married couples will be allowed to have a second child but the legislation maintains limits on additional births.
The "one child policy", instituted in the late 1970s, restricted most couples to only a single offspring and for years authorities argued that it was a key contributor to China's economic boom and had prevented 400 million births.
It has been enforced by a dedicated national commission with a system of fines for violators and often forced abortions, leading to heartrending tales of loss for would-be parents.
The policy led to sex-selective abortions or infanticide targeting girls, because of a centuries-old social preference for boys.
Rural families were already allowed two children if the first was a girl, while ethnic minorities were allowed an extra offspring, leading some to dub it a "one-and-a-half child" policy.
As a result China's population -- the world's largest at 1.37 billion -- is now ageing rapidly, gender imbalances are severe, and its workforce is shrinking.
These concerns led to limited reforms in 2013, including allowing couples to have two children if either of them was an only child, but relatively few have taken up the opportunity due to limited income and higher perceived opportunity costs.
Experts say that the shift to a two child policy is likely too little, too late to address China's looming population crisis and that the government is unlikely to dismantle enforcement mechanisms for reproductive control due to deeply entrenched bureaucratic interests.