Johnson's gold on the beam was her fourth medal of the Games and Liukin won five, including the all-around title. Liukin won one more medal at these Olympics than her father did at the 1988 Games while competing for the Soviet Union.
A fall by China's Li Shanshan cleared the way for the Americans to grab the top two medals.
Johnson received a score of 16.225 in the complicated system that determined the winners and losers in Beijing. Liukin had a 16.025 and Cheng Fei of China had 15.95 for the bronze.
Johnson became the second American Olympic winner on the balance beam. Shannon Miller pulled off the feat at the 1996 Olympics. This was also the first time two Americans had medaled in the event.
In the men's competition, China finished off a dominating show with victories by Li Xiaopeng on the parallel bars and Zou Kai on the horizontal bar.
American Jonathan Horton took silver on the bar.
China won seven of the eight gold medals available in men's gymnastics. Horton's silver was the only apparatus medal won by the United States squad, which got a surprising bronze in the team event.