Let G be a graph and let mij (G), i, j≥1, be the number of edges uv of G such that {dv (G), du (G)}={i, j} The M -polynomial of G is introduced with m(g; x, y)=å i≤j mij(G) xi yj It is shown that degree-based topological indices can be routinely computed from the polynomial, thus reducing the problem of their determination in each particular case to the single problem of determining the M -polynomial. The new approach is also illustrated with examples.