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

After Australia's openers piled up 158/0, swing bowlers Vernon Philander (4/56) and Kagiso Rabada (2/78), and left-arm spinner Keshav Maharaj (3/56) exposed the vulnerability of the Australian batting to dismiss the hosts for 244.

South Africa's Keshav Maharaj exults after taking an Australian wicket on the second day of the first Test. AP

South Africa were 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.

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

Australia lost 10 wickets for 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, Maharaj dismissed Smith LBW for his maiden Test wicket.

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 nine 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.

Warner batted for two-and-a-half 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 put on 126 and 123 with Chris Rogers 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 were at risk of conceding a first-innings deficit but Nevill (23) and Peter Siddle (18 not out) shared a 29-run eighth-wicket stand.