WASHINGTON (Reuters) - Legislation that would overhaul the controversial U.S. education law known as No Child Left Behind cleared a major hurdle on Monday when Senate leaders announced a bipartisan agreement on the bill.

The law, which went into effect in 2002, has been criticized as forcing teachers to adhere to a narrow curriculum to ensure students pass tests and imposing too harsh penalties on schools deemed "failing."

President Barack Obama recently began allowing states to opt out of some of the requirements in the law passed nearly a decade ago, saying Congress had been too slow to reform it.

Democrat Tom Harkin and Republican Mike Enzi, the two most powerful members of the Senate's Education Committee, forged an agreement on a bill that would give states more freedom to set the courses for their school programs.

"It will support teaching and learning rather than labeling and sanctioning, focus federal attention on turning around low-performing schools and closing achievement gaps, improve resource equity, and give states and schools the flexibility to innovate," said Harkin, who chairs the committee, in a statement.

The committee will take up the bill on Wednesday.

Education Secretary Arne Duncan gave the compromise a lukewarm reception, praising it for providing flexibility "while maintaining accountability at every level."

"I believe, however, that a comprehensive evaluation system based on multiple measures, including student achievement, is essential for education reform to move forward," Duncan said in a statement. "This view is shared by both national teacher unions and state leaders all across the country who are committed to doing a better job of preparing our young people for the global economy. We cannot retreat from reform."

No Child Left Behind was passed in Congress by both parties -- in the Senate its chief champion was Democrat Edward Kennedy. When it was signed by President George W. Bush in 2002, it ushered in an era of setting learning standards and testing students.

In September, Obama said states could apply for waivers from having to meet some of the standards set by the law, which expired four years ago and has been temporarily extended.

The U.S. government provides only about 8 percent of schools' funding but federal support has become more precious to school districts since the housing bust ravaged their primary source of revenue -- property taxes.

The Senate agreement would authorize grants to help local districts, improve school buildings, prepare students for college and support teacher development.

Obama has recently suggested repairing school buildings to provide jobs for unemployed construction workers.

The biggest educators' union, the National Education Association, said it was pleased with the agreement, noting it "recognizes the federal government's role is limited" in teacher evaluations.

(Reporting by Lisa Lambert; Editing by Cynthia Osterman)