The 18-year-old Canadian, ranked outside the top 150 at the start of the year, beat the German 6-4 3-6 6-4.
Kerber saved three match points on the Andreescu serve and broke back to trail 5-4 in the third set.
However, Andreescu produced a remarkable return game to win the biggest title of her fledgling career.
The win was another giant step in a breakout season for Andreescu, who finished 2018 ranked 178th in the world but will rise to 24th on Monday.
“It’s crazy,” Andreescu said. “Crazy is the word of the tournament for me. Just crazy.
“If you believe in yourself, anything is possible.
“The next is a Grand Slam. Let’s see where this can take me.”
Andreescu showed remarkable grit to fight back from a break down in the third set and put herself in front.
She grew tight when serving for the match and had cramp at the changeover, but her big hitting helped ensure a stunning win.
Andreescu now has 28 match wins this season – more than any other WTA player. She is also the first wildcard to win the Indian Wells title and the fourth-youngest champion in California.
Andreescu showed remarkable composure to become, at 18 years and 274 days, the youngest Indian Wells champion since Serena Williams – then aged 17 years and 169 days – in 1999.
She broke Kerber in the opening game of the match as the German double-faulted and dropped just two points behind her second serve in the first set.
Andreescu did not face a break point on her serve in taking that set and closed it out with her 10th forehand winner.
However Kerber, one of the best defensive players on the WTA Tour, saved two break points in the third game of the second set and took advantage as Andreescu faltered.
Kerber won three games in a row to take a 4-1 lead and Andreescu, struggling with the heat and her heavily taped right shoulder, sent a backhand into the net to send the match to a decider.
Andreescu fought back from 0-30 down to move into a 2-1 lead in the third before taking a three-minute medical timeout for her shoulder.
As Kerber broke and inched closer to the title, Andreescu called for her coach to come on court, telling him “I’m tired – I can barely move”.
Coach Sylvain Bruneau told her to “push through” – and she won four games in a row to break back and serve for the title.
Kerber’s brilliant play, including a defensive lob on the third match point, wrong-footed Andreescu, and the German forced the set to 5-4.
However Andreescu, despite looking exhausted, converted her fourth match point to claim her first Premier Mandatory title.
Premier Mandatory events are the top-ranked tournaments outside of the four Grand Slams.
Andreescu has had huge success in 2019 so far after struggling with injury earlier in her career.
Two stress fractures in her foot limited her 2016 season and she was hindered by a back injury in 2018.
She was ranked 152 at the start of the year but beat top seed Caroline Wozniacki, Venus Williams and Hsieh Su-wei to reach the Auckland final in January.
Andreescu took the first set off defending champion Julia Gorges but slipped to a three set defeat as her body became – in her words – “a mess”.
She has credited yoga and meditation for improving her on-court mentality, telling the WTA: “The mental part of the game is the most important because it controls your whole body”.
The Canadian keeps a spiral hair tie around her elbow when she plays and she sniffed from a jar that she keeps in her bag during her second round win over Stefanie Voegele.
When asked what was in the jar, Andreescu joked: “I’m never going to reveal my secret”.
(BBC SPORT)