Weed infestation is one of the main challenges in maize cultivation because it can reduce crop growth and productivity through competition for nutrients, water, light, and growing space. An automatic detection system is therefore needed to support precision agriculture, particularly for selective weed control. This study aimed to develop and evaluate a YOLOv5n-based detection model for identifying maize plants and weeds in agricultural field images. The dataset used in this study was obtained from the Weed Classification dataset available on Kaggle. Image annotation was performed using bounding boxes with two object classes, namely maize and weed. The dataset was divided into training, validation, and testing subsets using an 80:10:10 ratio. Model training was conducted on Google Colab for 100 epochs using an image size of 640 × 640 pixels and the YOLOv5n architecture. Model performance was evaluated using precision, recall, F1-score, and mAP@50. The results showed that the YOLOv5n model achieved an average precision of 0.894, recall of 0.923, F1-score of 0.908, and mAP@50 of 0.936. The maize class obtained a higher mAP@50 of 0.976, while the weed class achieved an mAP@50 of 0.897. These results indicate that YOLOv5n can effectively detect maize plants and weeds and has the potential to support precision agriculture applications, particularly selective spraying systems.