Using an effective Hamiltonian parametrized from first principles, Monte Carlo simulations are performed in order to study the piezoelectric response of BaTiO3 in the ferroelectric tetragonal phase as a function of temperature. The effect of an electric field on the phase behavior is also illustrated by a simulation of the transformation of a rhombohedral domain into a tetragonal one under a strong field.