Let G(3n, p, 3) be a random 3-colorable graph on a set of 3n vertices generated as follows. First, split the vertices arbitrarily into three equal color classes and then choose every pair of vertices of distinct color classes, randomly and independently, to be an edge with probability p. We describe a polynomial time algorithm that finds a proper 3coloring of G(3n, p, 3) with high probability, whenever p c/n, where c is a sufficiently large absolute constant. This settles a problem of Blum and Spencer, who asked if one can design an algorithm that works almost surely for p polylog(n)/n. The algorithm can be extended to produce optimal kcolorings of random k-colorable graphs in a similar model, as well as in various related models.