De Villiers, 30, set the new landmark during an innings of 149 against the West Indies in Johannesburg.
He smashed eight fours and 10 sixes in beating the previous ODI record of 36 balls by New Zealand all-rounder Corey Anderson against West Indies last year.
Chris Gayle's 100 from 30 balls in the Indian Premier League in April 2013 is the fastest century in cricket history.
South Africa scored 439-2 as they registered their highest ever ODI score, beating the 438-9 in a win against Australia in March 2006.
The total was just four short of the all-time ODI record score of 443-9 set by Sri-Lanka against Netherlands in July 2006.