The bloc also granted Georgia the status of candidate country, having previously been denied such title.
"A clear signal of hope for their people and for our continent," said Charles Michel, the president of the European Council.
Additionally, the EU "will open negotiations with Bosnia and Herzegovina once the necessary degree of compliance with the membership criteria is reached."
The European Commission will have to report by March on the progress made by the Balkan country to decide the next steps.
Thursday's breakthrough, achieved during a summit of leaders in Brussels, came amid Hungarian Prime Minister Viktor Orbán's veto threats and antagonistic rhetoric.
In the days leading up to the meeting, Orbán has questioned Ukraine's readiness to start negotiations and the Commission's credibility as an impartial arbiter. After being declared a candidate country in July last year, Ukraine was given seven reforms as a precondition to start the talks. Brussels has said the work is not yet complete but is sufficient to take the process to the next stage, something the Hungarian premier had challenged.
"Enlargement is not a theoretical issue, it's a merits-based, legally detailed process, which has preconditions," Orbán said upon arrival on Thursday. "If you haven't fulfilled the preconditions, there is no chance to start the negotiations."
"We have to come back later on and revert to that issue again when it is fulfilled by the Ukrainians," he added.
It was not immediately clear what made Orbán lift its veto. The PM is believed to have abstained during the vote, which required unanimity.
The news from Brussels quickly prompted a succession of social media posts celebrating what many leaders described as a "historic day."
"This is a victory for Ukraine. A victory for all of Europe. A victory that motivates, inspires, and strengthens," wrote Ukrainian President Volodymyr Zelenskyy, who delivered a video message during the summit urging leaders to make a positive decision.
"Moldova turns a new page today with the EU's go-ahead for accession talks. We're feeling Europe's warm embrace today. Thank you for your support and faith in our journey," said Moldovan President Maia Sandu.
"We're committed to the hard work needed to become an EU member. Moldova is ready to rise to the challenge," she added.
Estonian Prime Minister Kaja Kallas said the moment had happened "against all odds," while her Irish counterpart, Leo Varadkar, said the greenlight "will be a big boost for morale to know that Europe believes their rightful place is with us in our common home."
Thursday's decision has to be followed by a negotiating framework, a detailed document that sets a roadmap for the accession talks. The framework will have to be endorsed by the 27 member states, also by unanimity. This could happen as soon as March when EU leaders are next scheduled to meet provided Ukraine has fulfilled the remaining three preconditions.
After settling the matter of enlargement, EU leaders will now dive deep into the negotiations about the revision of the bloc's common budget, which includes a €50-billion special fund to provide Ukraine with long-term financial support.
Orbán has equally threatened to derail the fund.