Elgar, who came into the match with his position under scrutiny, scored 121 as he shared a second-wicket partnership of 179 with Faf du Plessis which frustrated the touring side who were the architects of their own downfall as they let numerous chances slip in the field.
Du Plessis will resume on a patient 99 along with Proteas captain Hashim Amla, who scored a double-century in the first test in Pretoria and has reached 17.
After being sent into bat, the day belonged to left-hander Elgar, who was involved in his fourth century stand in test cricket –- remarkably all with Du Plessis.
Following the early loss of out of form opener Alviro Petersen, caught at cover by Leon Johnson off Shannon Gabriel for 17, South Africa edged to 68 for one at lunch.
They pulled away in the afternoon session though as sloppy West Indies offered four lives to the batsmen and were made to pay for their profligacy.
Du Plessis, out for a duck in the first test, had eight when he slashed the ball to Marlon Samuels at gully off Jerome Taylor, but was dropped.
The right-hander, on 26, was also put down at first slip off left-arm spinner Sulieman Benn and the next ball the tall West Indian was left fuming as wicketkeeper Denesh Ramdin missed a simple stumping chance after Elgar skipped down the wicket with his score on 48.
Elgar was fortunate to survive a run-out chance on 73 when he gave up halfway down the wicket having called an impossible single to mid-on and watched with relief as the throw missed the stumps.
Elgar reached his century from 208 balls in an innings that would be described more as gutsy rather than fluent, but much needed for his test career.
He eventually fell when he edged debutant left-arm seamer Kenroy Peters to Ramdin.
The wicket showed variable bounce and took turn on the opening day, but is likely at its best for batting making the decision of the West Indies to bowl first, admittedly in overcast conditions, a brave one.
South Africa won the first test by an innings and 220 runs.
(Editing by Ed Osmond)