Smith scored 104 and De Villiers made an undefeated 122 to anchor South Africa's total of 253 for one, which they reached at stumps in reply to the West Indies' first innings of 296.
South African captain Smith faced 202 balls and hit 13 fours and a six in a solid but cautious innings.
The more aggressive De Villiers scored his runs off 236 balls and hit 13 fours and a six.
"It means a lot to me to score a century and help put us in a strong position," Smith said.
Smith and De Villiers took an important step towards shutting the West Indies out of the match with an opening stand of 191.
The partnership started in the fourth over of the day, and endured until the 19th over before the close when Smith skied a drive off the bowling of off-spinner Chris Gayle to Wavell Hinds at deep extra cover.
The West Indies wasted a chance to separate the openers in the sixth over after lunch with the total on 59 without loss.
Smith, on 25, sent an airborne drive off fast bowler Fidel Edwards into the covers where Dwayne Bravo dived to his left but failed to hold a one-handed catch.
10TH CENTURY
Smith went to his 10th test century with consecutive pulled fours through midwicket off fast bowler Daren Powell in the 16th over after tea.
De Villiers, who was 84 not out when Smith was dismissed, reached his second century in 10 tests with a single to mid-off off fast bowler Reon King 10 overs before the close.
"AB played with a lot of maturity," said Smith.
Boeta Dippenaar was 23 not out at stumps in a partnership of 63 for the unbroken second wicket.
Fast bowlers Andre Nel and Monde Zondeki needed just 20 deliveries between them to wrap up the West Indies' innings, which resumed on 292 for seven.
"We said we wanted to get off the field as quickly as possible, and that's exactly what we did," Smith said.
"Monde and Andre were superb this morning."
Zondeki, who took four for 50, struck with the fourth ball of the day when he had Powell caught behind by wicketkeeper Mark Boucher before a run had been added to the overnight total.
"We really wanted to get in there and get the job done as quickly as possible," Zondeki said.
In Zondeki's next over Edwards attempted to hook a bouncer but simply managed to lift the ball into the hands of Dippenaar at short leg and was out for two.
Nel, who took four for 56, ended the innings when Courtney Browne, who scored three, hooked a catch down the throat of Zondeki at fine leg.
Scoreboard
West Indies 1st innings
W. Hinds c Smith b Ntini 1
C. Gayle c Boucher b Nel 0
R. Sarwan c Prince b Nel 10
B. Lara b Nel 176
S. Chanderpaul c Boucher b Zondeki 53
R. Hinds c Boucher b Kallis 10
D. Bravo c Smith b Zondeki 26
C. Browne c Zondeki b Nel 5
D. Powell c Boucher b Zondeki 3
F. Edwards c Dippenaar b Zondeki 2
R. King not out 0
Extras (b-1 lb-3 nb-5 w-1) 10
Total (all out, 92.2 overs) 296
Fall of wickets: 1-2, 2-12, 3-12, 4-150, 5-171, 6-286, 7-288, 8-292, 9-296, 10-296
Bowling: Nel 21.2-3-56-4 (nb-1), Ntini 17-2-61-1, Kallis 14-6-37-1 (w-1), Zondeki 16-1-50-4 (nb-4), Smith 8-1-23-0, Boje 16-2-65-0
South Africa 1st innings
G. Smith c W. Hinds b Gayle 104
A. Villiers not out 122
B. Dippenaar not out 23
Extras (nb-4) 4
Total (for 1 wickets, 84 overs) 253
Fall of wickets: 1-191
To bat: J. Kallis, H. Gibbs, M. Boucher, A. Prince, N. B oje, M. Ntini, M. Zondeki, A. Nel
Bowling: Edwards 16-2-46-0 (nb-1), King 14-1-40-0 (nb-1), Powell 12-0-41-0 (nb-1), Bravo 15-3- 30-0 (nb-1), R. Hinds 6-0-31-0, Gayle 14-2-41-1, W. Hinds 6-0-17-0 Sarwan 1-0-7-0