The ship - the Aris 13 - is anchored off the Somali coast near the town of Alula.
Eight Sri Lankan crew were on the vessel when it was taken over on Monday and most of them were being held captive in a locked room.
An official said: "We tried to intercept a boat that was carrying supplies to the pirates, but pirates on the ship fired on us and so the pirate boat escaped."
One pirate named as Abdulaahi is claiming that the pirates have killed a member of the marine force and injured another - but the official has dismissed the claim.
Residents near the ship in the semi autonomous region of Puntland reported hearing gunfire.
This is the first hijacking in the region for five years, and maritime experts have accused ship owners of becoming complacent after a long period of calm.
The tanker, which was making its way from Djibouti to Mogadishu, had changed its course, heading towards the coastline of the northeastern tip of Somalia.
The cost and time saving route, paired with the ship's slow speed and lack of armed escort, left it vulnerable to attack.
According to reports, the oil tanker was about 18 kilometres off the Somali coast when it was attacked.
Talks had been taking place between the coast guards and the pirates, in an attempt to "free the boat without condition", but authorities made clear force would be used if necessary.
Pirates do not normally kill hostages unless they come under attack.
Families of the eight men have appealed to the pirates to release their loved ones unharmed, and said they fear for their relatives' lives.
Somalia's foreign ministry has said it is working to help ensure the "safety and welfare" of the crew members.
While the demands of the pirates are currently unclear, village elders said the pirates are driven by anger over illegal fishing, which has "destroyed" the livelihoods of Alula residents.
Attacks from Somali pirates began disrupting major international shipping routes back in 2005, with the crisis reaching its peak in 2011, when 736 hostages and 32 boats were held.
In one case, 26 Asian hostages were held captive by pirates for five years, before being released in October 2016.
In recent years, international anti-piracy patrols on the crucial trade route has managed to dramatically reduce such attacks.