Bennett, 27, who raced his first Tour de France last year and finished seventh in the 2016 Tour of California, is not noted as a time trial specialist, and most commentators believed he would struggle to maintain his position today.
American Andrew Talansky, lurking 44 seconds behind after winning the Mt Baldy stage, was expected to be the big mover and he duly made up all but a second of that margin on Majka.
But Bennett produced a ride out of the bag, just eight seconds slower than Talanksy, for the fourth-fastest performance over the course, to move into the lead.
"[After halfway] I knew I was on a good time, so I started pushing, pushing, pushing," he said. "At altitude, you can never really go over your limit, you can never go really deep and I just held it.
"When I crossed the line, all the cameras were coming and I thought 'sh**t, maybe I've done something good'. Nek minnit, I'm wearing a yellow jersey."
Talansky and Majka had outsprinted Bennett, riding for Team LottoNL-Jumbo, on the mountain stage 24 hours earlier, leaving tthe Kiwi with a sour taste in his mouth.
"The boys rode their hearts out for me all week," reflected Bennett. "Not matter what I'm racing for, you've got to respect them, so even if I was fighting fof the podium, I was going to be motivated.
"That's just being a professional, that just being a hungry cyclist ... I was always going to go full gas."
Tomorrow's final 125km stage from the Mountain High ski resort to Pasadena presents several challenges - mostly downhill, but with three King of the Mountain climbs and two intermediate sprints.
"It's close enough, it could come down to sprint bonuses," said Bennett. "it's not going to be a parade lap around Madrid, like we do in the Vuelta [Tour of Spain].
"This will be full-gas racing tomorrow ... the boys have got a big job."