This study aimed to evaluate the effects of oat β-glucan in combination with low- and high-dietary calcium phosphate (CaP) content on gastrointestinal bacterial microbiota, prevalence of butyrate-production pathway genes and fermentation end-products in 32 weaned pigs allocated to four diets: a cornstarch-casein-based diet with low [65% of the calcium (Ca) and phosphorous (P) requirement] and high CaP content (125% and 115% of the Ca and P requirement, respectively); and low and high CaP diets supplemented with 8.95% of oat β-glucan concentrate. Pigs were slaughtered after 14 days, and digesta were collected for quantitative PCR analysis, and quantification of short-chain fatty acids and lactate. The high CaP content reduced gastric lactate and streptococci and propionate in the large intestine. Oat β-glucan distinctly raised gastric bacterial numbers, and colonic lactobacilli and bifidobacteria. Although not reflected by gene copies of butyrate-production pathway genes, oat β-glucan also increased gastric, caecal and colonic butyrate concentrations, which may be favourable for intestinal development in weaned pigs. Thus, a high CaP content negatively affected the intestinal abundance of certain fermentation end-products, whereas oat β-glucan generally enhanced bacterial numbers and activity. The results emphasize the importance of the stomach for bacterial metabolism of oat β-glucan in weaned pigs.