Based on the responses of a pre-selected group of people after they voted today, the pollster predicted a victory over Leave, which garnered 48 per cent of the vote.
YouGov's eve-of-poll result came out of in favour of Remain with a margin of 51-49 excluding "don't knows".
A separate poll by Ipsos-Mori conducted today and yesterday put Remain on 54 per cent, while Leave had 46 per cent.
YouGov respondents had already given their voting intentions in the week. So, by re-contacting them, YouGov could assess last-minute shifts in opinion.
The pre-selected group of people were viewed as representative of the population and how the electorate actually voted in the referendum.
This poll will be a cause for concern for Leave campaigners, given how close YouGov came in the Scottish referendum last year.
Back then, it predicted 54 per cent to No and 46 per cent to Yes, just outside of the 55-45 result that resulted in Scotland remaining within the UK.
However, the poll is still just an indication and no exit polls were conducted after the referendum, unlike at the general election, due to methodological difficulties.