Chile had looked set to inflict another friendly defeat on Spain after they raced ahead with goals in the opening 20 minutes from Mauricio Isla and Eduardo Vargas in St Gallen.
However, reigning World Cup and European Championship winners Spain staged a memorable second-half revival to take the win.
Half-time replacement Andres Iniesta pulled a goal back in the 54th minute before his new Barcelona team-mate Fabregas drew the teams level in the 70th minute - just six minutes after he had come on in place of Alvaro Negredo.
Fabregas then struck a last-gasp goal to give Spain the victory, the former Arsenal skipper slotting in the rebound after he had seen his penalty saved by Claudio Bravo.
There was no way back after that for 10-man Chile, who had lost Pablo Contreras to a straight red card in the 82nd minute.
Spain have won all five of their Euro 2012 qualifying matches but have experienced mixed results in friendlies since winning the World Cup title last summer.
In seven matches, Vicente Del Bosque's men have been held by Mexico and suffered heavy defeats against Argentina and Portugal.
They were also beaten 2-1 by Italy in their previous friendly outing last month, and another defeat looked on the cards as Chile enjoyed the much better start on Friday night.
The South Americans, who were beaten 2-1 by Spain during the group stages of the 2010 World Cup, needed just 10 minutes to take the lead when Isla collected a superb long ball by Gonzalo Jara and then thumped an unstoppable shot across Iker Casillas into the far top corner.
Spain almost equalised through David Silva, whose shot was blocked by Bravo, before Chile doubled their lead in the 20th minute through Vargas, who played a one-two with another Barca new boy Alexis Sanchez before rounding Casillas and slotting home.
Jean Beausejour almost made it 3-0 in the 31st minute but Real Madrid custodian Casillas parried his shot.
Del Bosque made a treble change at the break, and one of the newcomers Iniesta helped get Spain back into the match.
Iniesta's club colleague Xavi gave his team-mate the ball 25 yards out and the man whose extra-time goal against Holland earned Spain the World Cup last July drilled a low shot past Bravo.
Del Bosque then threw on Fabregas and the playmaker, who has scored in his opening two games for Barca, helped Spain complete their comeback - with Iniesta continuing to play a key role.
Fabregas struck the equaliser after latching on to a great first-time through ball from Iniesta before poking his shot past the out-coming Bravo.
Then, after Chile had lost Contreras to a red card following a foul on Santi Cazorla, Fabregas claimed the victory for the Spanish.
Fernando Meneses fouled Alvaro Arbeloa inside the area and, although Fabregas' saw his penalty turned onto the post by Bravo diving to his left, the ball came straight back to the sub and he volleyed into the gaping net.
Towards the end of the match a scuffle broke out between the two teams, with Iniesta and Arturo Vidal squaring up before Arbeloa pushed the Chilean away. That led to a melee involving a number of players from both sides, where Sergio Ramos was seen to shove over Felipe Seymour.