The Spanish navy has released a video of an operation in West Africa this week that rescued a cargoship from a pirate hijacking.
The incident took place in the Gulf of Guinea.
The navy said the unnamed Nigerian-flagged vessel was being held by nine gunmen.
They had been on board for four days.
The patrol vessel Serviola sent armed personnel on two speedboats to the ship, as the video shows. It ends with a pirate craft speeding away.
Serviola had spotted the cargoship following an atypical course.
"When not receiving a response to the calls that were made by radio to the merchant ship, we proceeded to the vicinity of it to investigate the causes of the anomaly," the navy said.
The master told the navy that both the rapid approach of the warship and its continuous calls forced the gunmen to flee.
The pirates were armed with AK-47 rifles and grenades.
The captain added that initially he could not answer Serviola's calls while the pirates were pointing guns at him.
The attackers stole money and valuables from the 12 Nigerian crew, as well as most of their provisions.