Brewery spent grain (BSG) is the most abundant waste generated in the brewery industry, while brewery wastewater (WW) is usually disposed of improperly causing environmental impacts. Co-fermentation of both can offer an alternative to energy production, meaning progress in the transition towards a circular economy. To optimize hydrogen (H2) production from these types of waste, a Central Composite Rotational Design (CCRD) and Response Surface Methodology (RSM) were applied, considering the variables: BSG concentration (x1, 3.9-36.8 g TVS. L- 1), WW concentration (x2, 3.95-14.0 g COD.L- 1) and NaHCO3 concentration (x3, 0.1-5.0 g. L- 1) using autochthonous fermentative inoculum from brewery waste. The greatest effect on H2 production was attributed to the WW concentration, followed by the BSG and the NaHCO3 concentrations. The highest H2 production (43.52 +/- 0.42 mL g-1TVS) was obtained with 20 g BSG. L-1 , 9.0 g COD.L-1 of WW, and 2.6 g NaHCO3 L- 1. Under these conditions, butyric (2387.3 mg.L-1), acetic (2094.4 mg.L-1), and caproic (942.5 mg.L-1) acids predominated. The microbial structure mainly comprised Clostridium, Prevotella, Meyerozyma, and Rhodotorula, with a predominance of acetic-butyric fermentation for H2 formation. In the condition with the highest NaHCO3 concentration, bifidic fermentation and H2 production via lactic acid utilization were observed, with a predominance of Bifidobacterium, Prevotella, and Rhodotorula. The results made it possible to identify the better adjustment of substrate concentration variables and NaHCO3 to enhance energy recovery from H2 production.