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.
My expectation is that the Countess of Chester Hospital (CoCH) will honour the agreement reached and reverse the decision not to accept new elective referrals for Welsh patients.
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".
On point of fact, we were clearly informed that there were no ongoing negotiations to address the issue of contracting for cross border secondary (as opposed to tertiary) care prior to our decision. Nor are there any existing protocols which would mandate that we continue to accept underfunded elective referrals at the expense of investments in patient safety. Our focus remains the delivery of high quality services to the population we serve. We now look forward to agreeing a contract with Betsi Cadwaladr University Health Board in the knowledge that all patients will benefit from the planned safety investments enabled by appropriate resources.
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.
We hope it will act to reassure people with cancer in north Wales and help to reduce some of the extra distress that has been placed on them and their loved ones over recent weeks. At the heart of the decision to stop accepting patients from Wales, was the fact that people with cancer, who are already living with an anxious wait to start their cancer treatment, faced further stress over whether they would be able to access timely treatment because of where they live.