This paper analyses the impact of livestock feed prices and pasture quality on the long and short-term costs of milk production in a region of Spain (Navarre). The empirical results are obtained from the estimation of a flexible shortrun cost function, followed by the approximation of long-run equilibrium based on the quasi-fixed factors adjusted to their optimal levels. The results reveal a high sensitivity of milk production costs to changes in livestock feed prices due to two reasons. One is that, as milk production expands, it tends to become technologically more intensive. The other is that, in the current structure of dairy farming, land input is suboptimal, particularly in the case of large farms and areas of poor pasture. The results reveal that short-run substitution between feed and livestock is a potential strategy for farms to respond to feed price increases. They also suggest that structural policies designed to strengthen the dairy sector's competitiveness should vary according to agro-climatic conditions. In areas of poor pasture, herd growth might be used as a long-term measure to increase competitiveness through economies of scale; while the alternatives for farms in better-endowed regions also include extensification of dairy production.