Empirical work has failed to keep pace with recent advances in transaction cost theory and the theory of contract. The first econometric analysis of its kind is reported by using a new data set of small subcuntractors making specific inputs for customers in the engineering industry. The use of formal contracts is found to be strongly associated with specific investment and other variables measuring technological complexity and vulnerability to potential opportunism by customers. Furthermore, despite typically long-term relationships, over half of subcontractors avoid making efficient, specific investments. Overall, we find strong support for the transaction cost theory of contracts.