The suspected drug trafficker was Alfonso Contreras Espinoza, alias "El Poncho," according to a state official who was not authorized to be quoted by name.
Contreras Espinoza was arrested in July on weapons charges, but had been allowed out of a local prison under guard for treatment at a hospital for leg problems. He was believed to head the Cancun operations of the Gulf drug cartel.
The hyper-violent Jalisco cartel has been moving into the resort city over the last year, pushing out other gangs.
The state prosecutor's office said the four assailants overpowered one of the hospital guards and went to the area where Contreras Espinoza was being treated, killing him and his wife before escaping.
State police said in a statement that the attack "was a possible settling of accounts between drug gangs."
The private hospital is located not far from Cancun's tourist zone.
The incident was the third troubling event in the state in less than two weeks. On Thursday, undetonated explosive devices were found on a tourist ferry that runs between the Caribbean resorts of Playa del Carmen and the island of Cozumel. A Feb. 21 blast shook another ferry plying the same route, injuring 19 Mexicans and at least five U.S. citizens.
The U.S. Embassy in Mexico barred its workers from taking any tourist ferries on the line because of the explosive devices found in the latest incident.
Cancun, which is a popular travel destination, has been largely spared the violence plaguing the rest of Mexico. But in January 2017, gunmen attacked the state prosecutors' office in Cancun, killing four people. A day earlier, a shooting at a music festival in Playa del Carmen left three foreigners and two Mexicans dead.
Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.