Let \(X = \{X_0,\ldots ,X_m\}\) be a family of smooth vector fields on an open set \(\Omega \subseteq \mathbb {R}^N\) . Motivated by applications to the PDE theory of Hörmander operators, for a suitable class of open sets \(\Omega \) , we find necessary and sufficient conditions on X for the existence of a Lie group \((\Omega ,*)\) such that the operator \(L=\sum _{i = 1}^mX_i^2+X_0\) is left-invariant with respect to the operation \(*\) . Our approach is constructive, as the group law is constructed by means of the solution of a suitable ODE naturally associated to vector fields in X. We provide an application to a partial differential operator appearing in the Finance.