The structure of the algebra of first-order differential symmetry operators of the Klein-Gordon equation in an external electromagnetic field is investigated from positions of the theory of cohomologies of Lie algebras. A method for integrating the given equation is proposed, based on noncommutative reduction, and, as a consequence, the corresponding integrability condition is obtained. An example of an integrable Klein- Gordon equation in a spacetime with a Steckel metric is considered, which does not admit separation of variables when an electromagnetic field is switched on. tensor of which is invariant with respect to the group of motions of the spacetime metric. The goal of this work is to describe the structure of the algebra of first-order symmetry operators of the equation under consideration from positions of the theory of cohomologies of Lie algebras, and also to propose a method of integration using the indicated symmetry algebra. An integrability condition for the Klein-Gordon equation in an electromagnetic field is derived, expressed in terms of the dimensionality of the Lie algebra of the group of motions of the metric and the so-called cohomology index of this algebra, this index depending on the class of cohomologies defined by the electromagnetic field. Note that in contrast to the well-known method of separation of variables, the integration method proposed in this work is based on the idea of noncommutative reduction (1), which makes more effective use of the algebra of first-order differential symmetry operators. In a number of cases, this eliminates the necessity of investigating hidden symmetries of the problem, associated with Killing tensors of second rank (and higher), which must often be done in the case of separation of variables (2, 3). To wrap things up, this paper considers an example of the Klein-Gordon equation in spacetime with a four- dimensional group of motions of the metric, which is integrable with the help of the approach proposed here. An interesting qualitative aspect of the example is the possibility of separation of variables in this equation in the absence of an external electromagnetic field and the impossibility of doing so in its presence.