The detection of variables that contribute to the variation of a system is one of the most important considerations in the industrial manufacturing processes. This work presents the combination of Mahalanobis–Taguchi system and a hybrid binary metaheuristic based on particle swarm optimization and gravitational search algorithm (BPSOGSA) to perform an optimal feature selection in order to detect the relevant variables in a real process of foam injection in automotive industry. The proposed method is compared with other feature selection approach based in binary PSO algorithm. The experimental results revealed that BPSOGSA is faster and successfully converge selecting a smallest subset of features than BPSO. Moreover, the feature selection effect is validated through other widely used machine learning algorithms which improve their accuracy performance when they are trained with the subset of detected variables by the proposed system.