Basel, who were appearing in their first European semi-final, looked set to earn a draw after a contentious 87th-minute penalty from Fabian Schar cancelled out Victor Moses’ early opener.
However, deep into injury time, Luiz drove a 25-yard free-kick beneath the Basel wall and into the bottom-right corner to put Rafael Benitez’s side in control ahead of next week’s return leg at Stamford Bridge.
“We played against a good team. You could see the intensity and the pace of the game, but we had enough chances to score and the penalty, which was a surprise for everyone, could have made a difference,” interim manager Benitez told ITV.
“It is always important to win. To score an away goal is important, but to score two and win is even better.”
In the end, the only sour note for the visitors was a yellow card for Ashley Cole that rules him out of the second leg, although Basel will also be without centre-back Aleksandar Dragovic for the same reason.
Chelsea had welcomed Cole back after a three-week absence due to a hamstring injury, but their wariness was demonstrated by interim coach Benitez’s decision to deploy centre-back Luiz in a midfield holding role.
Basel eliminated Tottenham Hotspur on penalties in the quarter-finals, having knocked Manchester United out of last season’s Champions League, and they served early notice of their threat when Mohammed Elneny curled a cross onto the roof of the Chelsea net.
It was Chelsea, however, who took the lead in the 12th minute, to the disappointment of watching Basel native Roger Federer.
Frank Lampard drew a smart save from Yann Sommer with a near-post volley and from the resulting corner, the England midfielder’s cross struck Moses and ricocheted into the roof of the net.
Basel responded immediately, briefly forcing the visitors onto the back foot.
Chelsea goalkeeper Petr Cech tipped a stinging Schar free-kick over the bar, while Valentin Stocker hit the outside of the post with a drilled cross from the right.
The away side finished the half strongly, though, with Sommer producing a sharp reflex save to repel Ramires’ half-volley from close range.
Eden Hazard might have doubled Chelsea’s lead shortly before half-time, but a last-ditch challenge from Park Joo-Ho put him off just as he was about to take aim at the exposed Sommer.
In the opening exchanges of the second period, both sides hit the woodwork with chances that would have greatly altered the face of the game.
First, Stocker rolled a low shot against the base of Cech’s right-hand post, before Fernando Torres saw a left-foot snap-shot crash back off an upright after a bold run down the Chelsea left from Hazard.
Basel coach Murat Yakin introduced Marcelo Diaz and Jacques Zoua from the bench, and the hosts saw Fabian Frei and then Zoua shoot narrowly wide from just outside the box.
After several nervous moments in the Chelsea area, the hosts’ pressure told when Czech referee Pavel Kralovec penalised Cesar Azpilicueta for making contact with Stocker from behind.
Schar duly drilled his spot-kick down the middle, before Sommer produced a stunning point-blank save to deny John Terry, only for Luiz to strike in the fourth minute of added time to end Basel’s unbeaten home record in this season’s competition.
“The team reacted very well (to going behind) and we were even looking for a winner, but in the end we were the unlucky team,” said Yakin.
“We shouldn’t have conceded a goal like that, but overall it was a good performance.”
In the other semi-final, Fenerbahce hit the woodwork three times against Benfica but finally prevailed through a 72nd-minute Egemen Korkmaz goal to procure a 1-0 advantage ahead of the second leg in Portugal.
Korkmaz headed home powerfully from a corner at the Sukru Saracoglu Stadium to give Aykut Kocaman’s hosts a wafer-thin victory as they bid to reach their first ever European final.