TOKYO — Defying broad public opposition and large demonstrations, Prime Minister Shinzo Abe won a crucial vote in Parliament on Thursday for legislation that would give Japan’s military limited powers to fight in foreign conflicts for the first time since World War II.

Mr. Abe’s party and its allies in the lower house of Parliament approved the package of 11 security-related bills after opposition lawmakers walked out in protest and as demonstrators chanted noisily outside, despite a gathering typhoon. The upper chamber, which Mr. Abe’s coalition also controls, is all but certain to endorse the legislation as well.

The vote was the culmination of months of contentious debate in a society that has long embraced pacifism to atone for wartime aggression. It was a significant victory for Mr. Abe, a conservative politician who has devoted his career to moving Japan beyond guilt over its militarist past and toward his vision of a “normal country” with a larger role in global affairs.

Mr. Abe has pressed this agenda, though, against the wishes of much of the Japanese public, and his moves have generated unease across Asia, especially in countries Japan once occupied and where its troops committed atrocities. Final passage of the bills would represent a break from the strictly defensive stance maintained by the Japanese military in the decades since the war.