A hospital in England which said it would no longer take in patients from Wales is understood to be reversing the decision.
Health Minister Vaughan Gething said an agreement had been reached and that he expected the Countess of Chester Hospital to "reverse the decision" made last month.
In April the Countess of Chester Hospital announced it would no longer take in patients from Wales except for in emergencies or maternity cases. The decision could have impacted thousands of people in Flintshire.
At the time, the health board's Chief Executive said it had been a "difficult decision" made due to "unresolved funding issues". Susan Gilby added it had been taken with "great reluctance".
Now Wales' Health Minister has announced talks "at both Ministerial and official level with the UK Government" have led to a reversal of the decision.
Mr Gething added that he hoped the agreement would "provide reassurance to Welsh residents that depend on cross border healthcare".
The Chief Executive Officer of the Countess of Chester Hospital Trust said she was "grateful" for the hard work gone into resolving the issue.
She did add, however, that prior to making the decision the Trust had been informed there had been "no ongoing negotiations to address the issue".
Reacting to the news, cancer charity Macmillan said it welcomed the agreement but hoped it was "robust enough" to avoid similar situations in the future.