The objective of this study was to investigate the association between teat skin colonization and intramammary infection (IMI) with Staphylococcus aureus or Streptococcus agalactiae at the quarter level in herds with automatic milking systems. Milk and teat skin samples from 1,142 quarters were collected from 300 cows with somatic cell count >200,000 cells/mL from 8 herds positive for Strep. agalactiae. All milk and teat skin samples were cultured on calf blood agar and selective media. A subset of samples from 287 quarters was further analyzed using a PCR assay (Mastit4 PCR; DNA Diagnostic A/S, Risskov, Denmark). Bacterial culture detected Staph. aureus in 93 (8.1%) of the milk samples and 75 (6.6%) of the teat skin samples. Of these, 15 (1.3%) quarters were positive in both the teat skin and milk samples. Streptococcus agalactiae was cultured in 84 (7.4%) of the milk samples and 4 (0.35%) of the teat skin samples. Of these, 3 (0.26%) quarters were positive in both the teat skin and milk samples. The PCR detected Staph. aureus in 29 (10%) of the milk samples and 45 (16%) of the teat skin samples. Of these, 2 (0.7%) quarters were positive in both the teat skin and milk samples. Streptococcus agalactiae was detected in 40 (14%) of the milk samples and 51 (18%) of the teat skin samples. Of these, 16 (5.6%) quarters were positive in both the teat skin and milk samples. Logistic regression was used to investigate the association between teat skin colonization and IMI at the quarter level. Based on bacterial culture results, teat skin colonization with Staph. aureus resulted in 7.8 (95% confidence interval: 2.9; 20.6) times higher odds of Staph. aureus IMI, whereas herd was observed as a major confounder. However, results from the PCR analyses did not support this association. Streptococcus agalactiae was isolated from the teat skin with both PCR and bacterial culture, but the number of positive teat skin samples detected by culture was too low to proceed with further analysis. Based on the PCR results, Strep. agalactiae on teat skin resulted in 3.8 (1.4; 10.1) times higher odds of Strep. agalactiae IMI. Our results suggest that Staph. aureus and Strep. agalactiae on teat skin may be a risk factor for IMI with the same pathogens. Focus on proper teat skin hygiene is therefore recommended also in AMS.