A goal in each half from Jeremy Mathieu and Luis Suarez either side of Cristiano Ronaldo's 42nd goal of the season settled an enthralling encounter at Camp Nou.
The Catalan giants are now four points clear of Real at the top of the table with 10 games remaining, but Ancelotti stressed that his side can still be crowned champions.
He said: "The league isn't over. Barcelona have the advantage but anything can happen in football. We won't prioritise the Champions League."
The Real coach took heart from Real's performance and was left to rue lapses in concentration, which Barca capitalised on.
The Italian said: "Two very good teams played each other this evening. I think that we played well for an hour, up until the second goal. Then things turned complicated.
"We were very good in the first half. We were solid at the back but in the end we couldn't capitalise. We played well for an hour and not so well for half an hour.
"We were the better team for an hour but Barca's counter-attacks in the final half an hour were devastating. We're two great teams, and they've won on the night.
"I think the problem was more mental than physical. We didn't play in the same way that we did at the start of the game.
"We're disappointed but we go home knowing that we played a good game. That should give us some confidence for the rest of the season."
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.