In this paper, we study the effects of cointegration on optimal investment and consumption strategies for an investor with exponential utility. A Hamilton-Jacobi-Bellman (HJB) equation is derived first and then solved analytically. Both the optimal investment and consumption strategies are expressed in closed form. A verification theorem is also established to demonstrate that the solution of the HJB equation is indeed the solution of the original optimization problem under an integrability condition. In addition, a simple and sufficient condition is proposed to ensure that the integrability condition is satisfied. Financially, the optimal investment and consumption strategies are decomposed into two parts: the myopic part and the hedging demand caused by cointegration. Discussions on the hedging demand are carried out first, based on analytical formulae. Then numerical results show that ignoring the information about cointegration results in a utility loss.