Phishing emails called spam have created a need for reliable and intelligent spam filters. Machine-learning techniques are effective, but current methods such as Logistic Regression (LR), Support Vector Machine (SVM), Decision Trees (DT), and Naive Bayes (NB) sometimes produce low detection rates and struggle with large amounts of data. Motivated by these concerns, we propose an efficient spam-filtering approach, OAOS-LR, combining an improved Atomic Orbital Search (AOS) algorithm with an LR classification model. To remove the deficiency of low detection rate produced by the standard LR method due to the utilization of the gradient descent technique, we train it with our proposed OAOS approach, which uses AOS and Orthogonal learning to enhance the search capabilities of the conventional algorithm. In the experimental study, we first evaluated the performance of OAOS over the IEEE Congress on Evolutionary Computation (CEC’20) benchmarks against five different metaheuristics to prove its effectiveness in improving its convergence rate and reducing the probability of falling in local optima. After that, the proposed technique LR-OAOS was applied to the spam filtering problem using CSDMC2010 and Enron datasets and tested against the most recent machine learning and metaheuristic approaches using standard statistical measures and plots. OAOS-LR significantly outperformed other methods with an average F1-score success rate of 95.45% and 96.30% on CSDMC2010, and 74.80% and 78.33% on Enron, respectively with the number of feature spaces equal to 500 and 1000.