The Romanian finally put away the 114th ranked Kozlova with eight consecutive points in the second set, a backhand winner proving the decider just as it had in the first set.
"It was difficult for me to close out those sets," Halep told reporters, praising Kozlova. "When I was leading the match, she played without fear."
The victory advanced the French Open champion, who won Indian Wells in 2015, to the fourth round for the fifth time in six years.
WTA Indian Wells
Teenager Andreescu stuns Kerber to win Indian Wells title
17/03/2019 AT 22:53
The meeting was the first between the pair and featured big momentum swings. After Kozlova claimed a 3-2 advantage in the first set, Halep won three consecutive games to go to set point at 5-3 on Kozlova's serve.
With the former world number one's groundstrokes failing her, Kozlova reeled off 11 of the next 12 points, breaking back for 5-5 with a forehand winner.
Halep finally won the set on her third opportunity with another trademark backhand down the line.
The Romanian took four successive games for a 5-2 lead in the second set, but Kozlova again rallied to even the match at 5-5 before Halep reeled off the eight straight points to seal the win.
WTA Indian Wells
Kerber, Bencic power into Indian Wells semis
14/03/2019 AT 22:54
WTA Indian Wells
Teenager Andreescu crushes Muguruza at Indian Wells
13/03/2019 AT 21:45