The Senate vote was 97-1 against the President - only Senate Democratic Leader Harry Reid stood with Mr. Obama.
The House vote was 348-77. Most of the "no" votes in the House were from Democrats.
The White House did not mince words about the veto rebuke.
"This is the single most embarrassing thing the United States Senate has done possibly since 1983," said spokesman Josh Earnest.
The White House warned - in vain - that the legal move could open members of the U.S. military and intelligence services to legal actions.
"No country has more to lose from undermining that principle than the United States—and few institutions would be at greater risk than CIA," said CIA Director John Brennan in a rare agency statement on legislation in the Congress.
But lawmakers in both parties ignored those arguments from the Administration.
It was the first override of a veto by the Congress since the summer of 2008, when lawmakers made law a bill dealing with Medicare payments to doctors.
President George W. Bush had four vetoes overriden by the Congress; this was the first for President Obama.