Besides Obama, the bill also was a priority for his wife, Michelle, who launched a national campaign this year against childhood obesity.
"We can agree that in the wealthiest nation on earth all children should have the basic nutrition they need to learn and grow," Mrs. Obama said. "Nothing is more important than the health and well-being of our children. Nothing."
The $4.5 billion measure would expand free school meals for the needy and give the government power to decide what kinds of foods may be sold in schools.
The legislation also increases the federal reimbursement for free school lunches by 6 cents a meal at a time when many school officials say they can't afford to provide the meals. The new money also will allow 20 million additional after-school meals to be served annually in all 50 states. Most states now only provide money for after-school snacks.
Obama used the occasion to laud lawmakers of both parties for passing the bill, saying it shows they can unite on issues that affect the future of the nation's children.