The Costa Rican embassy's trade attache, Guillermo Cholele, was abducted in his diplomatic car from outside his home on Sunday night.
Details of his release are not known but a ransom was reportedly demanded.
He was the latest diplomat to be kidnapped in recent months in Venezuela, which suffers from high levels of violent crime.
Venezuelan Interior Minister Tarek El Aissami said via Twitter that Mr Cholele was in good shape and being taken by police to be reunited with his family.
His release had been secured due to investigative work and police pressure, Mr El Aissami wrote.
He said that more details on the diplomat's release would be issued later.
The Costa Rican authorities had earlier said that a ransom had been demanded.
It called the abduction "extremely serious" and said Mr Cholele needed medication for a heart condition and high blood pressure.
"For me, this kidnapping is organised crime and unfortunately Caracas is one of the most dangerous cities in the world and this is not an isolated case," Costa Rica's Deputy Foreign Minister Carlos Roverrsi said.
In January Mexican ambassador Carlos Pujalte and his wife were briefly kidnapped in Caracas before being released.
Last November the Chilean consul in Caracas was abducted, beaten and shot in the leg before being released.
In December, a diplomat from Belarus was also briefly kidnapped.
And just last month Karen Berendique - the teenage daughter of a Chilean diplomat - was shot dead by police.
Officers said she had failed to stop at a roadblock.
Venezuela has some of the highest rates of murder and kidnap in Latin America, with Caracas particularly affected.
The opposition coalition have made crime and insecurity a key issue in their campaign for October's presidential election.

A team from Strathclyde University in Glasgow tested 22 different brands of compost and found that 14 contained a variety of Legionella species.
It says a larger survey is needed to determine the extent of the issue.
The study, "Legionella spp. in UK composts - a potential public health issue", is published by Clinical Microbiology and Infection.
Dr Beattie, one of those who conducted the study, said: "Disease causing micro-organisms are widespread in the environment, and therefore it is not too surprising that species of Legionella that can cause human disease are present in compost.
"Any environment where you have pathogenic bacteria could be a source of infection, and we already know that compost has been linked to human Legionella infection in countries such as Australia and New Zealand."
Dr Beattie said European produced composts have traditionally been composed of peat, whereas those from Australia and New Zealand had more often used sawdust and bark.
"It may be that the change in composition of composts in the UK, moving away from peat-based products, could be resulting in species such as Legionella longbeachae being present in compost and therefore more cases of infection could occur," she said.
Dr Beattie wants a larger scale survey, covering a wider range of compost products, to be carried out to see if Legionella bacteria are as widespread in composts as her study suggests.
She added: "It should be emphasised though, that although Legionella seem to be common in compost, human infection is very rare, especially if you consider the volume of compost sold and used.
"But with any potential source of infection precautions should always be taken.
"The occurrence of these bacteria in composts in Australia and New Zealand, and the cases of infection that have been traced to compost has resulted in hygiene warnings on compost packaging in these countries, and this is something manufacturers in the UK may wish to consider."
The study was conducted by Dr Tara Beattie, fellow academic Dr Charles Knapp, Strathclyde PhD student Sandra Currie and Dr Diane Lindsay of the Scottish Haemophilus, Legionella, Meningococcus and Pneumococcus Reference Laboratory.
Venezuelan officials say a Costa Rican diplomat who was kidnapped in the capital, Caracas, has been freed.
[NEXT_CONCEPT]
Legionella bacteria appears to be "common" in many compost brands sold in the UK, a study has found.