We study the effect of credit conditions on the allocation of inputs, and their implications for aggregate TFP growth. For this, we build a new dataset for Mexican manufacturing merging real and financial data at the 4-digit industrial sector level. Using a simple misallocation framework, we find that changes in allocative efficiency account for 75 percent of aggregate TFP variability. We then construct a model of firm behavior with working capital constraints and borrowing limits which generate sub-optimal use of inputs, and calibrate it to our data. We find that the model accounts for 56 percent of the observed variability in efficiency. An important conclusion is that sectoral heterogeneity in credit conditions is key in accounting for efficiency gains. Despite overall credit stagnation, better credit and lower interest rates to distorted sectors contributed substantially to the recovery from the 2009 recession, suggesting a plausible mechanism for credit-less recoveries.