The polynomial we consider here is the characteristic polynomial of a certain (not adjacency) matrix associated with a graph. This polynomial was introduced in connection with the problem of counting spanning trees in graphs [8]. In the present paper the properties of this polynomial are used to construct some classes of graphs with an extremal numbers of spanning trees.