Scaling laws provide a simple yet meaningful representation of the dominant factors of complex engineering systems, and thus are well suited to guide engineering design. Current methods to obtain useful models of complex engineering systems are typically ad hoc, tedious, and time consuming. Here, we present an algorithm that obtains a scaling law in the form of a power law from experimental data (including simulated experiments). The proposed algorithm integrates dimensional analysis into the backward elimination procedure of multivariate linear regressions. In addition to the scaling laws, the algorithm returns a set of dimensionless groups ranked by relevance. We apply the algorithm to three examples, in each obtaining the scaling law that describes the system with minimal user input.