President Barack Obama on Wednesday declared the end of what he called America’s “outdated approach” to Cuba, saying the US would restore diplomatic ties, open an embassy in Havana and ease travel restrictions in a historic deal brokered with the help of Pope Francis.

“Isolation has not worked. It’s time for a new approach,” Obama said from the White House while announcing a stunning shift in US policy that aims to bring to ​​an end more than 50 years of Cold War hostility between the two countries.

As Obama ​made the announcement, Cuban President Raul Castro was speaking in Cuba, telling his people that the deal does not mean there will be any changes in the country’s internal policies.

“This shows we can resolve our differences without renouncing a single one of our principles,” said Castro, whose brother Fidel led the revolution that established Communist rule in the country. “This shows we can solve many of our problems and live in a civilized manner with our differences.”

The announcements followed more than a year of secret talks between the US and Cuba, including clandestine meetings in Canada and the Vatican and personal involvement from ​Pope ​Francis, who praised the deal in a tweet from the Vatican.

Obama and Castro spoke by phone for more than 45 minutes Tuesday, the first substantive presidential-level discussion between the US and Cuba since 1961.

The re-establishment of diplomatic ties was accompanied by Cuba’s ​humanitarian​ release of ailing American aid worker Alan Gross​. It also secured the swap of a top US spy held in Cuba​ in exchange​ for three Cubans who were jailed based on intelligence he​’d ​provided, Obama said.

“Cuba released one of the most important intelligence agents the United States has ever had in Cuba. This man is now safely on our shores,” Obama said.

The president spoke of how the US had mended fences with longtime Communist enemies China and Vietnam, and said that engaging Cuba was a better approach than isolating the island nation that sits just 90 miles from southern Florida.

Tourist travel remains banned under the new policy, but travel restrictions will be eased for those participating in cultural, religious, athletic, humanitarian and other activities.

Families with relatives in Cuba — who have been able to travel to the nation since Obama​ eased the ban in 2009 — can now also send more money to loved ones​, as much as $8,000 a year​, up from the current limit of $2,000.

And Americans in Cuba will be able to use their own credit or debit cards and bring home up to $400 in goods — including up to $100 worth of Cuban cigars and booze.

Obama also said he would work with Congress to lift an economic embargo imposed on the country, and pressure Castro’s Cuban government to increase personal and economic freedoms for Cuba’s people.

But, he warned, “I do not expect changes to bring about a transformation of Cuban policy overnight.”

Several hard-line Cuban-American senators immediately attacked the deal.

Sen. Marco Rubio (R-Fla.) said the policy Obama announced Wednesday did nothing to address those issues.

“But it potentially goes a long way in providing the economic lift that the Castro regime needs to become permanent fixtures in Cuba for generations to come,” Rubio said.

Robert Menendez, the Democratic head of the Senate Foreign Relations Committee, denounced Obama’s actions, saying they “vindicated the brutal behavior of the Cuban government.”

Menendez, in a statement, said trading Gross for “convicted criminals” from Cuba “sets an extremely dangerous precedent.”

Gross arrived at Andrews Air Force Base outside Washington late Wednesday morning after more than five years in prison. He was accompanied by his wife, Judy, along with several US lawmakers.

US officials said Cuba was taking some steps as part of the agreement to address its human rights issues, including freeing 53 political prisoners.

​Officials said the​ US​ spy who was released had been held for nearly 20 years and was responsible for some of the most important counterintelligence prosecutions that the US has pursued in recent decades.

Those include convicted Cuban spies Ana Belen Montes, Walter Kendall Myers and Gwendolyn Myers and a group known as the Cuban Five.

The three Cubans released in exchange for the spy are part of the Cuban Five — a group of men who were part of the “Wasp Network” sent by Cuba’s then-President Fidel Castro to spy in South Florida.

The men, who are hailed as heroes in Cuba, were convicted in 2001 in Miami on charges including conspiracy and failure to register as foreign agents in the US.

Two of the Cuban Five were previously released after finishing their sentences.

Gross was detained in December 2009 while working to set up Internet access as a subcontractor for the US government’s Agency for International Development, which does work promoting democracy in the Communist country. It was his fifth trip to Cuba to work with Jewish communities on setting up Internet access that bypassed local censorship.

Bonnie Rubinstein, Gross’ sister, heard the news from a cousin, who saw it on television.

“We’re like screaming and jumping up and down,” she said in a brief telephone interview from her home in Texas.

Cuba considers USAID’s programs illegal attempts to undermine its government, and Gross was tried and sentenced to 15 years in prison.

Gross’ family has said he was in poor health. His wife said in a statement earlier this month that Gross has lost more than 100 pounds, can barely walk due to chronic pain, and has lost five teeth and much of the sight in his right eye.

With Post wires