South Africa staged a remarkable comeback and shrugged off the loss of fast bowler Dale Steyn to injury in the first cricket test at the WACA on Friday.

After Australia's openers piled up 158-0, swing bowlers Vernon Philander (4-56) and Kasigo Rabada (2-78), and leftarm spinner Keshav Mahraj (3-56) exposed the vulnerability of the Australian batting to dismiss the host for 244 runs.

South Africa was bowled out for 242 after winning the toss and batting first on the opening day.

The visitors were in trouble at 45-2 in the second innings after losing opener Stephen Cook (12) and Hashim Amla (1). But opener Dean Elgar (46 not out) and Jean-Paul Duminy (34 not out) guided South Africa to 104-2 at the close, a lead of 102 runs.

Mahraj bowled with guile and control to claim the wickets of skipper Steve Smith, Peter Nevill and Mitchell Starc.

Australia lost 10-86 before and after lunch following an aggressive stand between David Warner (97) and Shaun Marsh (63).

Warner was racing toward his 17th career century when he pushed at a delivery from Steyn away from the body, and was caught by first slip Amla.

Warner's dismissal triggered a top-order collapse as Australia lost Usman Khawaja (4), Smith (0), and Marsh in the space of 23 runs before lunch.

Khawaja was yorked by Rabada, and two overs later, Mahraj dismissed Smith lbw for his maiden test wicket.

Jean Paul Duminy ended 34 not out (Getty)

Soon after dismissing Warner, Steyn left the field. Maharaj completed Steyn's unfinished over and in his very next over trapped Smith, who unsuccessfully reviewed the on-field decision.

"Losing 9 for 80 is disappointing in any context in this game," Warner lamented. "I accept responsibility as well as a top order batter. We always talk about one guy going on and getting a big hundred."

Despite the loss of Steyn, Warner believes South Africa remains a formidable opponent in series.

"They've still got two very, very good fast bowlers, and we've seen the wickets they're capable of with the ball going both ways. We have to respect that.

"I'm disappointed for Dale. I know how pumped he would've been. I know he's had this injury for a while, I just hope he can get back on the park."

Steyn was taken to a nearby hospital for scans and was diagnosed with a rare bone stress which may force him out of the game for at least six months, according to team officials. Steyn will return home at the end of the first test.

South Africa lost Dale Steyn early on to injury (Getty)

Warner batted for 2 hours and hit a six and 16 fours. He has shared century opening stands in each of the past three tests against South Africa, after he and Chris Rogers put on 126 and 123 in the last two tests of the 2013-14 series.

Marsh played second fiddle to the aggressive Warner, and batted for over three hours and hit seven fours off 148 balls.

Resuming on 181-4 after lunch, Australia immediately lost Mitchell Marsh (0) trapped lbw by Philander. But Adam Voges (27) and Nevill lifted the innings before Rabada took a return catch to dismiss Voges off a leading edge.

Australia slumped to 203-7 when Starc (0) was well caught by Faf du Plessis off Maharaj.

Australia was at risk of conceding a first-innings deficit but Nevill (23) and Peter Siddle (18 not out) shared a 29-run eighth-wicket stand.