Substitute Costa slipped the ball past the keeper from close range in the 48th minute of the second half to break the deadlock and extend Brazil's winning run to 11 matches.
Following this stunning turn-around of fortunes for Barcelona, here is a flashback of some of the best come-from-behind wins recorded in Europe's premier club competition.
Real Madrid coach Zinedine Zidane warned that it was still all to play for in their Champions League last-16 clash against Napoli after the holders strolled to a 3-1 win in the first leg on Wednesday.
Lionel Messi is set for his first start for nearly two months when Barcelona, fresh from pulverising Real Madrid 4-0 at the weekend, set their sights on Champions League qualification when AS Roma visit the Nou Camp on Tuesday.
Real Madrid's stuttering run continued as they were held 1-1 at home by La Liga minnows Eibar on Sunday, drawing a fourth consecutive game in all competitions for the first time in more than a decade.
Images from football matches played across Europe on Sunday.
Portugal international Goncalo Guedes fired Valencia into the lead in the 35th minute with a thumping shot from inside the area which was too powerful for Madrid goalkeeper Keylor Navas.
Leaders Barcelona and Real Madrid were held to draws while Sevilla made up ground on the top two and Alaves slipped after a promising start. Here are five talking points from the weekend's La Liga action.
Yaya Toure looked more relieved than elated as he lifted the African Nations Cup for the first time.
IMAGES from the Champions League matches played on Wednesday.
Luka Modric pulled one back for Zinedine Zidane's shellshocked side with a brilliant strike from distance early in the second half before substitute Vinicius Jr reduced the deficit to one goal.
River Plate battled back to beat arch Argentine rivals Boca Juniors 3-1 in extra-time in an unforgettable and unique Copa Libertadores final second leg, played in Madrid after violence had seen the original game postponed.
Peru striker Paolo Guerrero scored a hat-trick to give his side a comfortable 3-1 victory over Bolivia at the Copa America on Thursday, setting up a last-four showdown with hosts Chile.
A summary of Saturday's football action across the world.
Villarreal tightened their grip on fourth place in La Liga when Nigerian forward Ikechukwu Uche's last-gasp strike snatched a 1-0 win at fellow promoted side Elche on Monday.
After setting a Spanish record 35 matches unbeaten in all competitions, Barcelona coach Luis Enrique is relishing the run-in to the end of the season with his side on course for a second successive La Liga, King's Cup and Champions League treble.
Beat Real Madrid's unbeaten run in the 1988-89 season, and thump Rayo Vallecano 5-1
'He said sorry, he's not happy with the red card, but it's over now. These things happen and we can't chance it, but with 10 men we still managed to equalise'
Cristiano Ronaldo scored twice as Real Madrid beat Athletic Bilbao 4-2 in a thrilling match at the Bernabeu to move within a point of leaders Barcelona in La Liga on Saturday.
Algeria opened the goal scoring floodgates swamping South Korea 4-2 in a thrilling World Cup Group H clash on Sunday that kept hopes of securing a spot in the last 16 alive and triggered celebrations across the Arab nation.
Ten-man Greece held Japan to a 0-0 draw that will suit neither side in a Group C match, which ended with boos ringing around the Dunas arena and sent Colombia into the last 16 of the World Cup on Thursday.
A late equaliser cost hosts Equatorial Guinea an opening win at the African Nations Cup finals as they drew 1-1 with Congo on Saturday before Gabon beat Burkina Faso 2-0 to top Group A.
Real Sociedad coach David Moyes praised his side's determined defending after their 1-0 victory over Barcelona.
Luis Suarez has progressed from his impressive debut La Liga campaign to produce the most prolific season of his career and fire Barcelona to a second straight title, free of the stigma of his ban for biting which accompanied him to Spain in 2014. It was fitting that the Uruguayan should score a hat-trick in the comfortable 3-0 victory at Granada on Saturday to clinch the title, taking his tally to 40 goals in 35 games. He is the first player other than Cristiano Ronaldo and Lionel Messi to finish as La Liga top scorer since 2009 but his contribution to Barca's title triumph goes beyond his goals and 16 assists. For Suarez is the hardest working of the feted 'MSN' partnership he forms with Messi and Neymar, a trio who have delivered 90 of Barcelona's 112 league goals. He is also the most willing to close down opponents and run into space and, naturally, he has shown himself to be the player who is keenest to throw himself into any physical battle.
While Juventus look forward to a first Champions League final in more than a decade and the riches that success brings, former employees at the Italian giants' Singapore-based soccer school push on with their fight for unpaid wages.
Barcelona's poor run away to Real Sociedad continued when the champions were held to a 1-1 draw at Anoeta on Sunday and slipped six points behind La Liga leaders Real Madrid before next week's 'Clasico' against their arch rivals.
Coach Diego Simeone goes home 'content' after his team's 1-0 loss in their Champions League match on Wednesday
Casemiro headed an 89th minute winner to earn Real Madrid a barely deserved 2-1 victory at Las Palmas in La Liga on Sunday as they closed the gap on second-placed Atletico Madrid to four points.
Barcelona's outlay of 20 million euros ($22 million) on Jeremy Mathieu last July prompted plenty of criticism but the France centre back has been worth his weight in gold in the La Liga leaders' last two outings.
Portugal rested Cristiano Ronaldo and still overcame new-look Italy 1-0 in their opening Nations League match on Monday, giving visiting coach Roberto Mancini plenty to think about. Forward Andre Silva scored three minutes after halftime in the League A Group 3 game to give the Portuguese their first win over Italy in a competitive match since 1957.
IMAGES from the La Liga matches played on Tuesday
News of all that's transpired on and off the football field
Cristiano Ronaldo scored a hat-trick to send Real Madrid through to the Champions League semi-finals with a 4-2 extra-time win and 6-3 aggregate success against 10-man Bayern Munich in controversial circumstances on Tuesday.
Gareth Bale was once again subjected to whistling from a section of the Bernabeu crowd.
A summary of Friday's night's qualifying matches for Euro 2020.
Rediff.com brings you these and other exciting news from the week gone by in this photo feature...
Heavyweight trio Manchester City, Manchester United and Chelsea kept up their 100 per cent starts to the Premier League season this weekend.
It will be "immensely difficult" for Real Madrid to improve their squad but they still plan to make more signings in the close season, new coach Rafa Benitez said.
News of all that's transpired on and off the football field