The Civil Guard said in a news release the incident happened off the coast of Costa del Sol, after Spanish maritime patrol agents were trying to intercept a boat suspected of carrying drugs that had four people on board.
During the chase, officials said both vessels collided, causing three police officers to fall into the water after the agent's boat went "out of control."
A police helicopter then hovered overhead and called on the four suspected drug traffickers to help using a megaphone. The group then helped pull the officers to safety.
"The crew of the helicopter of the Malaga Air Unit, upon realizing the imminent danger to the civil guards, required the occupants of the other vessel to support them by public address, being rescued by them and being all unharmed," police said in a news release.
Even though they helped rescue the officers, the four men were arrested for drug trafficking.
Authorities recovered more than 80 bundles of hashish that had fallen to the sea that weighed more than 3 tons, according to the Civil Guard.