The hard-fought legislation that allowed the United States to avoid the “fiscal cliff” was signed into law Wednesday by “autopen,” the White House said, less than a day after being approved in a contentious vote in the House of Representatives.

President Obama, who interrupted a family vacation here to oversee the cliff negotiations in Washington, returned to Hawaii on an overnight flight that arrived early Wednesday. He spent the day working out a local gym, golfing and dining with first lady Michelle Obama and some friends at a favorite Hono­lulu restaurant, Alan Wong’s.

In between, Obama reviewed a copy of the cliff legislation, titled the “American Taxpayer Relief Act of 2012,” and directed that the original — still in Washington — be signed by autopen.

In May, 2011, Obama became the first American president to use the autopen to sign legislation when he directed that the mechanical device be used to sign an extension of the Patriot Act. Previously, White House aides had often traveled overseas to hand-deliver just-passed legislation to the president to be signed.

Obama was in Europe at that time, and the legislation was passed only a few hours before the Patriot Act was due to expire. Some Republican lawmakers questioned the legality of using the autopen, but the White House said it had legal backing to do so.

The deal agreed to by the House and Senate reduces the deficit from what it would have been if all expiring individual tax provisions had been extended, but it increases the deficit compared with the 10-year impact of going over the cliff.

The president and his family will remain in Hawaii until this weekend, the White House said.

The cliff legislation that passed late Tuesday night was approved over the objections of many of House Republicans, but with comfortable bipartisan majorities in both the House and the Senate. It raises taxes on individual net income over $400,000 ($450,000 for couples) while holding rates steady for income below that amount.

The bill pushes off for a few weeks the debate over how to cut spending in order to tame the nation’s soaring debt and whether to raise the nation’s debt ceiling to allow the United States to borrow enough to pay its bills.

Also Wednesday, Obama signed the National Defense Authorization Act — in person, using his own hand and a non-automated pen. That legislation had been delivered to the White House by Congress over the weekend, while Obama was in Washington, and he brought it with him on the long flight to Hawaii.

Obama said in a statement that he signed the bill into law “because it authorizes essential support for service members and their families, renews vital national security programs, and helps ensure that the United States will continue to have the strongest military in the world.”

At the same time, he said, he disagreed with several provisions in the act, including restrictions on which ships and aircraft the Defense Department may retire; whether the department may pursue cost-sharing measures in health-care programs ; how to protect the ”freedom of conscience” rights of military chaplains and service members with regard to gay marriage; and where and how terror suspects can be housed, transferred and interrogated.

Wilgoren reported from Washington.