But health officials have warned that unless MMR (measles, mumps and rubella) vaccinations continue, a further outbreak cannot be ruled out.
There have been no laboratory-confirmed cases linked to the outbreak area since 22 May, Public Health Wales said.
One person died and a total of 1,219 measles cases were diagnosed during the outbreak since November.
Some 88 people visited a hospital due to the disease while a campaign was launched to boost the uptake of the MMR vaccine.
Dr Marion Lyons, director of health protection for Public Health Wales (PHW), said that the end of the outbreak was in "no small part to unprecedented efforts to vaccinate tens of thousands of people".
"Without so many vaccinations being given, we know that the outbreak could have continued for many more months," said Dr Lyons.
But PHW warned that with 30,000 children in the 10 to 18 years age group still unvaccinated across Wales, there was still a possibility of a further outbreak in the future.
And the health minister urged parents to get their children vaccinated.
Dr Lyons said: "The only reason this outbreak could happen was because not enough young people in Wales were fully vaccinated with two doses of MMR and there is absolutely no guarantee that this could not happen again."
Some 75,868 unscheduled vaccinations were given to people around Wales who had not been immunised in a bid to bring the epidemic under control.
GP surgeries, hospital and schools held drop-in sessions, with PHW particularly keen to target children and young people who may have missed their scheduled jabs.
Health Minister Mark Drakeford said he "wholeheartedly" welcomed the end of the outbreak but insisted there was "still work to do".
"The young people in the 10 to 18 age group who still have not been vaccinated should make the necessary arrangements at their earliest convenience," he added.
"We would not want to see another outbreak.
"I would like to thank the healthcare professionals for their tireless work in organising and staffing the unscheduled vaccinations drop-in sessions and GPs for the contribution of primary care among others."
Large numbers of children in the 10-18 age group were not given the MMR vaccine as babies, the result of a scare that caused panic among parents.
It followed research by Dr Andrew Wakefield in the late 1990s which linked the vaccine with autism and bowel disease.
His report, which was published in The Lancet medical journal, was later discredited, with health officials insisting the vaccine was completely safe.
PHW said that even though the outbreak was over, a small number of measles cases were seen in Wales every year - in 2011 there were 19 cases - and parents should still ensure their children were fully vaccinated.
The first dose of MMR should be given at around 12-13 months of age and the second at around three years and four months of age - but it is never too late to catch up on missed doses, say health officials.
PHW advises that anyone born in 1970 or later who has not had measles or two doses of MMR should be vaccinated.
Any babies younger than 12 months who were advised to receive early vaccination as a result of the outbreak will still be called for routine vaccination and should still attend these appointments.
It is not dangerous to receive more than two doses of the vaccine, PHW added.
The measles outbreak centred on the Abertawe Bro Morgannwg health board area - which covers Swansea and Neath Port Talbot - along with the Powys health board area and Hywel Dda, which covers Pembrokeshire, Carmarthenshire and Ceredigion.
The Welsh Conservatives renewed their calls for a public inquiry into the epidemic so that lessons could be learned and failings identified.
On Monday, an inquest heard that Gareth Colfer-Williams, 25, died from pneumonia after contracting measles during the Swansea outbreak.
He was found dead on his sofa in his flat on 18 April, days after seeing GPs and complaining of a rash all over his body.
The measles epidemic centred on the Swansea area has been declared over eight months after it began.