WASHINGTON — Battling a powerful anti-trade tide, President Obama vowed on Tuesday to continue pressing for his historic trans-Pacific trade deal over opposition from both Hillary Clinton and Donald J. Trump, saying the agreement is essential for America to thrive in a global economy.

“Right now, I’m president, and I’m for it,” Mr. Obama said of the 12-nation Trans-Pacific Partnership, when asked by a reporter about opposition from both of the candidates who want to succeed him. “I think I’ve got the better argument.”

Mr. Obama made his comments Tuesday during a news conference with Lee Hsien Loong, the prime minister of Singapore, in the East Room of the White House.

The trade accord, the largest regional trade deal in history, would rope together nations from Canada and Chile on one side of the Pacific Ocean to Japan, Singapore and Australia on the other, creating a web of new rules on trade, labor, environmental conservation and intellectual property rights.