Betis scored the first goal in the sixth minute through a penalty, before Frenkie de Jong equalized it in ninth.
Betis got ahead again in the 26th minute, while Sergio Busquets scored at the stroke of half-time to keep the deadlock.
While Clément Lenglet scored the winner in the 72nd, he and Nabil Fekir were sent off, as Barca maintained the lead to win.
This win will give us motivation and extra energy: Setien
"In Bilbao, we played well, but they knocked us out. This win will give us motivation and extra energy for the future," said Barca manager Quique Setien, who was under fire following their Copa del Rey quarters loss to Athletic Bilbao.
Some interesting stats from the match
Some key stats from the match:
Messi became the second player, after Jadon Sancho, to reach the double figures for both goals and assists across the top five European leagues in this season.
Messi is also the second player, after Timo Werner, among the players of the top five European leagues, to script a hat-trick of goals and assists in 2019-20.
Messi in 2019-20
Messi leads the season chart for most goals and assists
With this win, Barca are on the second spot in La Liga table, three points behind Madrid.
Meanwhile, Messi continues to dominate the goal-scoring tally this season, having scored 14, while he is followed by Madrid's Karim Benzema, who has scored 13.
Messi also leads the tally with the most number of assists (11), followed by his team-mate Luis Suarez, who has seven.