AbstractWe analyze the determinants of real estate and credit bubbles using a unique borrower-lender matched dataset on mortgage loans in Spain. The dataset contain real estate credit and price conditions (loan principal and spread, and the appraisal and market price) at the mortgage level, matched with borrower characteristics (such as income, labor status and contract) and the lender identity, over the last credit boom and bust. We find that lending standards are softer in the boom than in the bust. Moreover, despite some adjustment in lending conditions in the good times depending on borrower risk, the results suggest too soft lending standards and excessive risk-taking in the boom. For example, mortgage spreads for non-employed are identical to employed borrowers during the boom. Banks with worse corporate governance problems soften even more the standards. Finally, we analyze the mechanism by which banks could increase the supply of mortgage loans despite of regulatory restrictions on LTVs. The evidence is consistent with banks encouraging real estate appraisal firms to introduce an upward bias in appraisal prices (29%), to meet loan-to-value regulatory thresholds (40% of mortgages are just bunched on these limits), thus building-up the credit and the real estate bubble.