Betis scored twice in the first half before adding two more in the second period, with Barcelona - who had Ivan Rakitic sent off in the 81st minute - suffering their first defeat since the end of September.
Ernesto Valverde's side remain top of the division on 24 points, but Real Madrid will have the chance to move within four points of their Clasico rivals when they travel to Celta Vigo on Sunday night.
Lionel Messi - back in the team after recovering from a fractured arm - and Malcom both had attempts for Barcelona in the first five minutes of action, but the first serious chance of the match fell to Betis in the sixth minute.
Barcelona continued to dominate the possession in the period that followed, but it was Betis that shocked Camp Nou by taking the lead in the 20th minute.
Barcelona's goalkeeper had to keep out a strike from Loren Moron in the 23rd minute as Betis looked for a second, but the hosts also had an excellent chance three minutes later, with Clement Lenglet's close-range effort saved by Betis goalkeeper Pau Lopez.
Betis had two more opportunities just past the 30-minute mark, but Cristian Tello saw his low strike saved by Ter Stegen before Moron just turned a Junior cross wide of the post from close range.
Betis's second goal was coming, and it arrived in the 34th minute when Joaquin turned a low Tello cross into the bottom corner to hand the away side the two-goal lead that they richly deserved.
Loren just missed the post with an effort in the 40th minute as Betis looked for a third, but the visitors had to settle for a half-time lead of 2-0 following an excellent opening 45 minutes of football.
Some magic from Messi created a shooting chance early in the second period, but the Argentine's effort from just outside the box was wide of the post.
Sergio Busquets then headed over the crossbar in the 51st minute as Barcelona desperately looked for a route back into the match.
Luis Suarez was next to try his luck following a quiet first period for the South American, but the striker's low attempt was always moving wide of the Betis post.
Betis had the chance to put the match well and truly beyond Barcelona in the 64th minute when Tello broke into the home side's box, but his low effort was just flicked wide of the post.
Barcelona had one back in the 68th minute, however, when Messi converted from the penalty spot after Betis winger Tello had brought Jordi Alba to the deck just inside the penalty box.
Betis scored a third less than four minutes later though, and it was a shocker from Ter Stegen, who allowed a weak Giovani Lo Celso effort to squirm through his fingers.
The Spanish champions had Rakitic sent off for a second bookable offence in the 81st minute, however, and they then conceded a fourth two minutes later when Sergio Canales converted a low cross from Junior.
Gerard Pique headed a golden chance over the Betis crossbar in the 89th minute as Barcelona eyed a late sting in the tail, and they did manage to score a third in stoppage time when Messi's effort, which had initially been ruled out, was eventually given following a VAR review.
Betis hold on in the final seconds, however, to edge what was a seven-goal thriller at Camp Nou.
BARCELONA (4-3-3): Ter Stegen; Roberto, Pique, Lenglet, Alba; Arthur (Vidal 46'), Busquets (Alena 70'), Rakitic; Messi, Suarez, Malcom (Munir 57')
REAL BETIS (3-4-3): Lopez; Sidnei, Bartra, Mandi; Junior, Guardado, William, Tello; Joaquin (Canales 62'), Moron (Leon 76'), Lo Celso (Inui 87')body check tags ::