The House passed the NDAA with a 220-197 vote after 251 lawmakers backed the amendment on war with Iran.
The amendment includes provisions that would prevent the US president from carrying out offensive strikes on Iran without Congress' approval.
“If the President wants to go to war, he needs to come to Congress first. The Constitution gives Congress - not the President - the power to declare war," Congressman Eliot Engel, chairman of the House Committee on Foreign Affairs, said before the voting got underway.
Lawmakers also amended the defence bill to include provisions that seek to end US support of the Saudi-led coalition in Yemen and rescind the administration's policy that bans transgender individuals from joining the US military.
The House defence bill will now have to be reconciled with the defence bill that the Senate approved in June.
The White House has indicated that President Donald Trump will veto the House version of the bill.
Tensions between the US and Iran have escalated dramatically since Trump last year pulled the US out of the international nuclear deal with the Islamic Republic.