The purpose of this study was (1) to predict the quantitative concentration of vitamin B12 in milk using mid-infrared (MIR) spectrometry, and (2) to evaluate the potential of MIR spectra to discriminate different clusters of records based on their B12 concentration. Milk samples were collected from 4,340 Holstein cows between 3 and 592 d in milk and located in 100 herds. Samples were taken using in-line milk meters and divided into 2 aliquots: one for MIR spectrometry and the other for B12 concentration reference analyses by radioassay. Analyses were performed on 311 selected spectral wavelengths. A partial least squares regression model was built to quantify B12 concentration. Discriminant analysis was used to isolate B12 concentration clusters. A B12 concentration threshold was set at 442 ng/dL, because this represents the cutoff value for a 250-mL glass of milk to fulfill 46% of the daily vitamin B12 recommended dietary allowance for individuals 14 yr or older. For each analysis, records coming from two-thirds of herds were used to calibrate prediction equations, and the remaining records (one-third of herds for validation) were used to assess the prediction performance. In the case of discriminant analysis, validation sets were divided into evaluation sets (one-third of herds) to obtain alternate probability cutoffs and in test sets (two-thirds of herds) to validate equations. Spectral and B12 concentration outliers were identified by calculating standardized Mahalanobis distance and with a residual analysis, respectively (n = 3,154). Regarding quantitative B12 concentration, cross-validation and validation coefficients of determination averaged 0.51 and 0.46, respectively, which are relatively low, which would limit the potential use of the developed quantitative equations. In addition, root mean square errors of prediction of cross validation and validation sets averaged 88.9 and 94.7 ng/dL, respectively. Area under the receiver operating characteristic curve of test sets averaged 0.81 based on the 442 ng/dL threshold, which could be considered to represent good accuracy of classification. However, the false discovery rate averaged 36%. In summary, models predicting quantitative B12 concentration had low cross-validation and validation coefficients of determination, limiting their use, but the proposed discriminant models could be used to identify milk samples with naturally high B12. Copyright © 2020 American Dairy Science Association. Published by Elsevier Inc. All rights reserved.