Aim This study focused on the spatiotemporal variation of the benthic diatom community structure in salt marshes from the Patos Lagoon estuary and their relationship with environmental variables. Methods Samplings were carried out in the winter of 2010 and summer of 2011 (during El Niño and La Niña) in sites with different sediment granulometry, salinity, and distances from the Atlantic Ocean. The surface sediment was collected using a core (10 cm in diameter and 2 cm in depth) and the benthic diatoms were removed following the Trapping method, allowing the observation of live diatoms. Results The richness values (18 and 48 taxa), evenness (0.41 and 0.68), and Shannon diversity indices (2.02 and 3.31 bits/ind.) variations were not significative between the sites and seasons, although temperature and salinity differed significatively between winter and summer. However, the diatom's composition and distribution were related to temperature, salinity, and sediment particle size. Mainly the species Hippodonta hungarica, Luticola simplex Navicula cf. cryptotenelloides, N. erifuga, N. jacobii, Nitzschia filiformis var. conferta, Planothidium frequentissimum and Tryblionella calida were associated with lower temperature and lower salinity in the winter. The species Navicula cf. cryptocephala, N. phylleptosomaformis, Nitzschia pusilla, N. frustulum, N. scalpelliformis and Pseudostaurosiropsis geocollegarum were associated with higher temperature and higher salinity in the summer. Birraphid diatom taxa, mainly species of the genus Navicula and Nitzschia, were frequent or abundant in sandy sediments, and monoraphids, such as Planothidium frequentissimum, were frequent in sites where silt and clay predominated. Conclusions The composition of the benthic diatoms revealed variation between the sites in the winter and summer seasons, during El Niño and La Niña episodes. In winter, high rainfall and freshwater runoff maintained oligohaline condition in the marshes, while in summer, flooding with meso-poly-euhaline waters changed the diatom composition. The granulometry was an important factor in explaining the distribution of the birraphid and monorhapid taxa.