Brain tumors are regarded as one of the most lethal, devastating, and aggressive diseases, significantly reducing the life expectancy of affected individuals. For this reason, in pursuit of advancing brain tumor diagnostics, this study introduces a significant enhancement to the YOLOv5m model by integrating an Enhanced Spatial Attention (ESA) layer, tailored specifically for the analysis of magnetic resonance imaging (MRI) brain scans. Traditional brain tumor detection methods, heavily reliant on expert interpretation of MRI, are fraught with challenges such as high variability and the risk of human error. Our innovative approach leverages the ESA layer to acutely focus on salient features, significantly improving the method ability to differentiate between common classes of brain tumors-meningioma, pituitary, and glioma tumors. By processing spatial features with enhanced precision, the model minimizes false positives and maximizes detection reliability. Validated against a comprehensive dataset of 3064 T1-weighted contrast-enhanced MRI images from 233 patients, our modified YOLOv5m architecture demonstrates superior performance metrics compared to the standard model, highlighting its potential as a robust tool in clinical applications for automated and precise brain tumor diagnosis.