TOKYO—Japan’s parliament on Friday ratified the Trans-Pacific Partnership trade agreement, a mostly symbolic step because of opposition by President-elect Donald Trump that is forcing Tokyo to look at other free-trade deals.

Mr. Trump said last month he would pull the U.S. out of the 12-nation TPP on his first day in office in January. The agreement requires U.S. ratification to come into force.

Assuming...