We consider the generic quadratic first integral (QFI) of the form $I=K_{ab}(t,q)dot{q}^{a}dot{q}^{b}+K_{a}(t,q)dot{q}^{a}+K(t,q)$ and require the condition $dI/dt=0$. The latter results in a system of partial differential equations which involve the tensors $K_{ab}(t,q)$, $K_{a}(t,q)$, $K(t,q)$ and the dynamical quantities of the dynamical equations. These equations divide in two sets. The first set involves only geometric quantities of the configuration space and the second set contains the interaction of these quantities with the dynamical fields. A theorem is presented which provides a systematic solution of the system of equations in terms of the collineations of the kinetic metric in the configuration space. This solution being geometric and covariant, applies to higher dimensions and curved spaces. The results are applied to the simple but interesting case of two-dimensional (2d) autonomous conservative Newtonian potentials. It is found that there are two classes of 2d integrable potentials and that superintegrable potentials exist in both classes. We recover most main previous results, which have been obtained by various methods, in a single and systematic way.