The conservative Popular Party (PP) came in joint second place along with centrist party Ciudadanos, with 20.4 percent of the vote each, according to the latest quarterly survey carried out July 1-10 by the Sociological Research Centre (CIS). Anti-austerity party Podemos garnered 15.6 percent of the vote.
In the previous CIS poll released in April, the Socialists had been in second place with 22 percent support, behind the PP, in power at the time, which had 24 percent.
It is the first time since 2009 that the Socialists topped the closely watched CIS survey, the party's spokeswoman in the lower house of parliament, Adriana Lastra, told reporters.
It was also the first CIS poll since the surprise change of government in Spain in June,following a no-confidence vote which toppled the PP after dozens of officials were charged in a high profile corruption case.
The survey was taken before the PP last month picked arch-conservative Pablo Casado, 37, to replace ousted prime minister Mariano Rajoy as leader, in a move seen as a lurch to the right.
With just 84 Socialist lawmakers out of 350, Prime Minister Pedro Sanchez, 46, heads up a government that holds the smallest minority in history.