China devalued its currency after a run of poor economic data, a move it billed as a free-market reform.