WASHINGTON—House lawmakers voted Wednesday to authorize Speaker John Boehner to file suit against President Barack Obama on a complaint that he had overstepped his legal authority, setting up a possible constitutional test and giving both parties a potent campaign issue to take home for the five-week congressional recess.

In a 225-201 vote, the House told Mr. Boehner (R., Ohio) to move ahead with the suit. House GOP leaders have said they would focus the suit on the White House's decision last year to give employers a one-year...