It was Betis' first win at Barca in more than three years and took them up to third place with 30 points, six points behind leaders Real Madrid who play later on Saturday at Real Sociedad. Barcelona are languishing in seventh on 23 points.
With Barca's decisive Champions League match away to Bayern Munich coming up on Wednesday, Xavi rested three of his most important players - Gerard Pique, Frenkie de Jong and Ousmane Dembele - but the decision backfired.
Betis were dangerous on the counter-attack and Juanmi, who earlier had a goal disallowed by VAR for a close offside call, struck a clean finish past keeper Marc-Andre ter Stegen after fine build-up play by Sergio Canales and this one did count.
“They scored when we were playing better, we can’t allow this type of counter-attack to happen,” Xavi told reporters.
“It’s a defeat that hurts. We were at home, playing well in the second half. We need to get better, but I think we deserved more. It was a unfair punishment after playing a good game.”
With Ousmane Dembele on the bench, Barca needed Philippe Coutinho to step up, but it was another disappointing afternoon for the Brazilian, who failed to create any chances.
He came off for Dembele just before the hour mark with boos ringing in his ears from around the stadium.
Betis played better until Frenchman Dembele came on and changed the game. He almost scored on at least four occasions and was leading Barca's blitz until Betis caught them off guard.
Canales sprinted from the right, with Christian Tello and Juanmi in the middle, three on three against a defence out of position. Canales had the patience to wait until Tello was inside the area and gave him the ball near the penalty spot.
Tello slowly rolled the ball to the left for Juanmi, who scored what proved to be the winner with a precise shot.
Barca had a scare in the first half when Gavi, 17, went off after being hit on the back of the head by a Hector Bellerin shot. "Gavi was taken to hospital following protocol after being dazed during the game by a blow to the head," the club said.