In this paper the random walk hypothesis is tested for a set of daily Brazilian stock data given by the São Paulo Stock Exchange Index (IBOVESPA) in the period of 1986-1998. A rolling variance ratio test for different investment horizons was conducted, and it is concluded that prior to 1994 the random walk hypothesis is rejected but after that it cannot be rejected. Institutionally maturing markets, increasing liquidity and the openness of Brazilian markets for international capital can explain this increase of efficiency of the Brazilian stock market. An error-correction model is used to explain the relationship between the IBOVESPA and foreign portfolio inflows. Evidence suggests that the release of foreign capital control is one of the main determinants of increased efficiency in the Brazilian equity market.