The President of the European Council Donald Tusk announced the agreement on Twitter on Monday morning.
He called the extension a "flextension" – a flexible extension – meaning that if MPs in London approve the Brexit deal, then the UK could leave the EU sooner than January 31st.
If the UK parliament does ratify Boris Johnson's Withdrawal Agreement then it is believed the UK would leave the EU on the first day of the following month, so December 1st or January 1st.
The EU27 has agreed that it will accept the UK's request for a #Brexit flextension until 31 January 2020. The decision is expected to be formalised through a written procedure.— Donald Tusk (@eucopresident) October 28, 2019
The announcement of the extension had been expected on Friday but was delayed after the French objected to a longer extension unless there was a guarantee of a general election.
But on Monday morning, in a sign the French had agreed to drop their demand for a shorter extension, a diplomatic source hinted that a three-month delay was "very probable".
The indication by a French source said that a potential three-month extension is hugely significant given that Paris was always seen as the major EU player most wary of another delay.
French president Emmanuel Macron has repeatedly expressed impatience over the repeated postponements of Brexit, saying they are getting in the way of his vision of reforming the European Union.
"The conditions of the extension have been specified and reinforced, notably on the fact that the deal (reached between Britain and the EU) is not renegotiable," added the French source.
"France insisted on the necessary conditions to preserve the unity of the 27 (remaining members of the EU)."
British lawmakers are due to vote Monday afternoon on Johnson's call for an early election to be held on December 12th.
The French source said that the chance of elections in Britain – which could result in a reconfigured parliament and help Johnson push through the deal – had "clearly strengthened over the weekend."
The Scottish National Party and the Liberal Democrats, who oppose Brexit, said over the weekend they could back the snap elections under certain conditions.