WASHINGTON—President Barack Obama won the biggest foreign-policy fight of his second term Thursday when supporters of his nuclear accord with Iran thwarted an effort to cripple it, paving the way for the deal’s implementation.

The victory was sealed in a procedural vote, as the Senate voted 58-42, short of the 60 votes needed, on a measure aimed at derailing the international agreement. The vote effectively ends a bitter, partisan fight in Congress over the accord, and spares Mr. Obama from the need for a veto to safeguard...