Twice doubles gold winner Williams, seeking her first singles medal, powered to a 6-0 6-3 win over Denmark's Caroline Wozniacki to book her place in the final four.
Belarusian Azarenka, who needs to win gold to guarantee that she remains world number one, broke early to take a 4-1 lead, before Kerber fought back to level at 4-4.
"It was definitely a really tough one," Azarenka told reporters.
"I tried to be aggressive and I tried to take control. It was very difficult as it was important who took command first and started to be more aggressive."
Seemingly competing for the loudest scream as they slogged it out from the baseline, the German number seven seed ploughed the ball into the net to hand Azarenka a break and the set.
The pair traded two breaks each in the second set before Azarenka, sporting a bright green skirt and headband and red top, snatched a third to serve for the match at 5-3.
But the left-handed German was not quite done yet, apologising as she saved two match points with fluky backhands which bounced off the top of the net.
After Azarenka threw away a third opportunity to wrap up the match, Kerber managed to claw it back to 5-5. But serving to stay in contention, she sent a shot long to give the world number one the victory.
"I always think about medals but I don't think about it on court. I just try to do my job and focus on the present and not really think about the future because if I'm focused and playing well the result will take care of itself," Azarenka said.
Russia's Kirilenko overcame 2011 Wimbledon winner Petra Kvitova of the Czech Republic 7-5 6-3 to set up her semi-final meeting with Sharapova, ensuring a medal for the nation.
World number three Sharapova ended Kim Clijster's hopes of winning a medal at her first and last Olympics, beating the Belgian 6-2 7-5 to book her place in the final four.
Mother-of-one Clijsters, who plans to retire for a second time after the U.S. Open in September, put up a valiant fight. She was broken in the second set but levelled the score only to be broken again.
With the Russian serving for the set, Clijsters gave it one last push, saving a match point before ploughing a backhand into the net to hand her opponent the victory.
"Of all the matches that I've played against her, this is the best that she's served, and on grass it's going to be tough to beat her," said Clijsters.
- Related links