Identifying the mechanisms that structure niche breadth and overlap between species is important for determining how species interact and assessing their functional role in an ecosystem. Without manipulative experiments, assessing the role of foraging ecology and interspecific competition in structuring diet is challenging. Systems with regular pulses of resources act as a natural experiment to investigate the factors that influence the dietary niches of consumers. We used natural pulses of mast-fruiting of American beech (Fagus grandifolia) to test whether optimal foraging or competition structure the dietary niche breadth and overlap between two congener rodent species (Peromyscus leucopus and P. maniculatus), both of which are generalist consumers. We reconstructed diets seasonally over a 2-year period using stable isotope analysis (δ13C, δ15N) of hair and of potential dietary items and measured niche dynamics using standard ellipse area calculated within a Bayesian framework. Changes in niche breadth were generally consistent with predictions of optimal foraging theory, with both species consuming more beechnuts (a high-quality food resource) and having a narrower niche breadth during masting seasons compared to nonmasting seasons when dietary niches expanded and more fungi (a low-quality food source) were consumed. In contrast, changes in dietary niche overlap were consistent with competition theory, with higher diet overlap during masting seasons than during nonmasting seasons. Overall, dietary niche dynamics were closely tied to beech masting, underscoring that food availability influences competition. Diet plasticity and niche partitioning between the two Peromyscus species may reflect differences in foraging strategies, thereby reducing competition when food availability is low. Such dietary shifts may have important implications for changes in ecosystem function, including the dispersal of fungal spores.