In a politically and emotionally charged debate, Democrats said majority Republicans in the chamber were debasing the Constitution in order to force a vote that could hurt Democrats in the election.
Supporters insisted that Congress has always had authority to limit federal court jurisdiction, and the legislation is needed to protect an affirmation of religion that is part of the national heritage.
The bill, which was passed 247-173, would prohibit federal courts, including the Supreme Court, from hearing cases involving the pledge and its recitation and would prevent federal courts from striking the words "under God" from the pledge.
The legislation has little chance of advancing in the Senate this year, but it laid down another marker for politicians seeking to differentiate themselves from their election opponents on the volatile social issues of the day. Other "wedge" issues that have or could come up before the election include gay marriage and flag burning.
The Supreme Court in June dismissed, on a technicality, a 2002 federal court decision that the religious reference made the pledge unconstitutional.
Rep. Todd Akin, R-Mo., the author of the amendment on legislation before the House Thursday, said the high court is likely to rule differently if it considers the substance of the case and "if we allow activist judges to start creating law and say that it is wrong to somehow allow schoolchildren to say 'under God' in the pledge."
In such a scenario, Akin said, Congress will have "emasculated the very heart of what America has always been about."