The production of biodiesel by methanolysis of highly acidic crude palm oil has been optimized for the Zr-SBA-15 heterogeneous acid catalyst. A dual optimization procedure has been carried out using surface response methodology and selecting the yield towards fatty acid methyl esters (FAMEs) as main response factor. Selected target variables for the optimization were: acidity of the synthesis media, zirconium loading, ageing temperature (all three for the synthesis of the catalyst); and temperature, methanol to oil molar ratio, catalyst loading (for the reaction tests). Quadratic equations were obtained for both models and their statistical analysis led to the optimal conditions for Zr-SBA-15 synthesis (0.67N HCl media concentration, 130°C ageing temperature, 10 Si/Zr molar ratio), and for the transesterification reaction conditions (209°C, 12.45wt% catalyst loading, 45.8 methanol to oil molar ratio). Under these optimized conditions FAME yield reached 92mol% after 6h. Additionally, reusability tests revealed that the optimized Zr-SBA-15 catalyst displays an excellent reaction stability, being fully regenerated after calcination at 450°C. Moreover, the high catalytic activity and stability achieved with crude palm oil is retained when using waste cooking oil (WCO) or low-grade fats such as category-1 fat, waste lard and mixed fats, leading to FAME yields over 90% after 6h, for each raw material, and with acidities in the final product lower than 2.5mg KOH per gram.