The United States has confirmed it helped a Cuban spy imprisoned in California artificially inseminate his wife back in Cuba.

The spy, Gerardo Hernandez was serving a double life sentence until his release as part of a prisoner swap, which was completed the same day the United States and Cuba announced they would restore diplomatic ties after more than 50 years.

The US freed him and two other Cuban agents in exchange for US foreign aid worker Alan Gross, a Cuban who had been spying for Washington, and 53 unidentified prisoners.

Mr Hernandez and his wife, Adriana Perez, are expecting his baby in two weeks, even though he was locked up for 16 years without conjugal visits.

"We can confirm the United States facilitated Mrs Hernandez's request to have a baby with her husband," the US Justice Department said in a statement.

"The request was passed along by Senator (Patrick) Leahy, who was seeking to improve the conditions for Mr Gross while he was imprisoned in Cuba."

Senator Leahy, a Democrat from Vermont, had long been active in attempting to free Mr Gross, who was arrested in 2009 for bringing banned telecommunications technology into Cuba for the US Agency for International Development.

Mr Hernandez, 49, was one of five Cuban agents captured 16 years ago and given long prison terms, all of them hailed as "anti-terrorist heroes" in Cuba for infiltrating Cuban exile groups at a time when anti-Castro extremists were bombing Cuban hotels.

When the so-called Cuban Five were honoured in a ceremony at Cuba's National Assembly on Saturday, Ms Perez appeared alongside Mr Hernandez with an obvious baby bump, raising questions about how she became pregnant.

Mr Hernandez patted her belly and smiled, a signal of harmony within the marriage.

Later that day, he told Cuban television she became pregnant through "remote control" but gave no details.

CNN first reported on Sunday it was done by artificial insemination.

The New York Times reported that Cuban officials collected the sperm sample and transported it through Panama.

Ms Perez, 44, became pregnant on the second such attempt, the Times said.

The baby will be a girl called Gema, Cuban official media said.

ABC/Reuters