Britain will spend £25 million on a new prison in Jamaica so hundreds of foreign criminals can be sent home to the Caribbean rather than serve their sentences in the UK.
The foreign aid-funded project has been agreed to break the deadlock in lengthy negotiations over a compulsory prisoner transfer deal between the two countries.
More than 600 Jamaican nationals are behind bars in Britain - the third most from any country - but cannot be repatriated because of fears that poor jail conditions on the island would allow a successful challenge under human rights law.
David Cameron announced the deal - which officials say could save taxpayers £10 million a year when transfers begin in 2020 - as he arrived in the Commonwealth country for a short visit.
The Prime Minister had been at the United Nations in New York, where he joined allies for talks on how to step up the fight against the Islamic State group (IS).
More than 300 existing offenders are expected to be sent back under the Jamaica prison scheme, which covers those sentenced to at least four years who have 18 months or more left to serve in custody.
The UK's contribution represents around 40% of the cost of the planned 1,500-capacity jail.
Mr Cameron - making the first trip to the island by a British prime minister since Tony Blair in 2001 - said the agreement would benefit both countries.
He is also announcing a wider £300 million injection of aid funding on infrastructure projects across the Caribbean, including roads, bridges and ports.
"It is absolutely right that foreign criminals who break our laws are properly punished but this shouldn't be at the expense of the hardworking British taxpayer," he said.
"That's why this agreement is so important. It will mean Jamaican criminals are sent back home to serve their sentences, saving the British taxpayer millions of pounds but still ensuring justice is done.
"And it will help Jamaica by helping to provide a new prison, strengthening their criminal justice system."
Almost 70% of the Jamaicans behind bars in Britain are serving sentences for violence and drug offences.
Mr Cameron said the regional infrastructure fund - to be delivered in collaboration with the Caribbean Development Bank - would "help the Caribbean on their path of development - supporting economic growth and creating new opportunities for people living here".
He said: "It will help to fund upgrades to ports, new roads and new bridges - making it easier here for businesses to trade with one another and with the rest of the world. And it will help benefit British businesses too who have the knowledge and expertise to deliver the infrastructure improvements needed.
"It makes the United Kingdom one of the largest bilateral donors to the region - concrete proof of our determination to reinvigorate this relationship."
The infrastructure fund will be available to eight aid-eligible Commonwealth countries in the region - Jamaica, Guyana, Belize, Dominica, Grenada, St Lucia, Antigua and Barbuda, and St Vincent & the Grenadines - as well as Montserrat, as an aid-eligible overseas territory.
Mr Cameron was greeted at the airport in Kingston by an honour guard and national anthems before heading off to visit RFA Lyme Bay, the British ship currently on anti-drug smuggling and emergency relief duties in the Caribbean.
He is due to finish the day by having talks with the prime minister Portia Simpson-Miller and a reception.