Abstract. Let g be a Lie algebra, E a vector space containing g as a subspace. The paper is devoted to the extending structures problem which asks for the classification of all Lie algebra structures on E such that g is a Lie subalgebra of E. A general product, called the unified product, is introduced as a tool for our approach. Let V be a complement of g in E: the unified product g ♮ V is associated to a system (⊳, ⊲, f, {−, −}) consisting of two actions ⊳ and ⊲, a generalized cocycle f and a twisted Jacobi bracket {−, −} on V . There exists a Lie algebra structure [−, −] on E containing g as a Lie subalgebra if and only if there exists an isomorphism of Lie algebras (E, [−, −]) ∼ = g ♮ V . All such Lie algebra structures on E are classified by two cohomological type objects which are explicitly constructed. The first one H 2 g (V, g) will classify all Lie algebra structures on E up to an isomorphism that stabilizes g while the second object H 2 (V, g) provides the classification from the view point of the extension problem. Several examples that compute both classifying objects H 2 g (V, g) and H 2 (V, g) are worked out in detail in the case of flag extending structures.