Ten pirates armed with rifles attacked the vessel before dawn off Malaysia's northern Langkawi island in the Malacca Strait, said marine police commander Abdul Rahman Ahmad.
One of the tanker's 19 crew members jumped overboard, fled with the pirates' motorboat and alerted mainland authorities, Abdul Rahman said.
The tanker was carrying diesel and oil products from Port Klang in western Malaysia to Myanmar.
The standoff ended three hours after police chased down and surrounded the ship, he said.
The pirates, believed to be Indonesians, initially threatened to blow the tanker up, but after negotiations with police they surrendered, casting their rifles into the sea, said Noel Choong, head of the International Maritime Bureau's piracy watch center in Kuala Lumpur.
"We congratulate the policefor successfully carrying out a smooth rescue without the loss of any lives or injuries," Choong said.
The attack was the seventh this year in the strait, a pirate-infested route bordered by Malaysia, Indonesia and Singapore. Officials recorded 37 attacks last year in the waterway.
Mokhtar Othman, a northern marine police spokesman, said officials will investigate whether the pirates were linked to those who abducted two Japanese and one Filipino from a Japanese-registered tug boat near the same location in March. The abductees were later released unharmed.
Police in Langkawi were interrogating the pirates, Mokhtar said, adding that it was not immediately clear whether the attackers' motive was robbery or kidnapping.
More than 50,000 vessels each year ply the strait, which links Asia to Europe and the Middle East, carrying half the world's oil and a third of global commerce.
Malaysia is expected to launch a new maritime security agency in November to combat piracy and other crimes on the high seas using 72 police, naval and customs patrol vessels.