Using Cohomology, Lemma \ref{cohomology-lemma-base-change-map-flat-case} in (1) is allowed since $g'$ is flat by Morphisms, Lemma \ref{morphisms-lemma-base-change-flat}. Having said this, part (1) follows from part (2). Namely, part (1) is local on $S'$ and hence we may assume $S$ and $S'$ are affine. In other words, we have $S = \Spec(A)$ and $S' = \Spec(B)$ as in (2). Then since $R^if_*\mathcal{F}$ is quasi-coherent (Lemma \ref{lemma-quasi-coherence-higher-direct-images}), it is the quasi-coherent $\mathcal{O}_S$-module associated to the $A$-module $H^0(S, R^if_*\mathcal{F}) = H^i(X, \mathcal{F})$ (equality by Lemma \ref{lemma-quasi-coherence-higher-direct-images-application}). Similarly, $R^if'_*\mathcal{F}'$ is the quasi-coherent $\mathcal{O}_{S'}$-module associated to the $B$-module $H^i(X', \mathcal{F}')$. Since pullback by $g$ corresponds to $- \otimes_A B$ on modules (Schemes, Lemma \ref{schemes-lemma-widetilde-pullback}) we see that it suffices to prove (2). \medskip\noindent Let $A \to B$ be a flat ring homomorphism. Let $X$ be a quasi-compact and quasi-separated scheme over $A$. Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module. Set $X_B = X \times_{\Spec(A)} \Spec(B)$ and denote $\mathcal{F}_B$ the pullback of $\mathcal{F}$. We are trying to show that the map $$ H^i(X, \mathcal{F}) \otimes_A B \longrightarrow H^i(X_B, \mathcal{F}_B) $$ (given by the reference in the statement of the lemma) is an isomorphism. \medskip\noindent In case $X$ is separated, choose an affine open covering $\mathcal{U} : X = U_1 \cup \ldots \cup U_t$ and recall that $$ \check{H}^p(\mathcal{U}, \mathcal{F}) = H^p(X, \mathcal{F}), $$ see Lemma \ref{lemma-cech-cohomology-quasi-coherent}. If $\mathcal{U}_B : X_B = (U_1)_B \cup \ldots \cup (U_t)_B$ we obtain by base change, then it is still the case that each $(U_i)_B$ is affine and that $X_B$ is separated. Thus we obtain $$ \check{H}^p(\mathcal{U}_B, \mathcal{F}_B) = H^p(X_B, \mathcal{F}_B). $$ We have the following relation between the {\v C}ech complexes $$ \check{\mathcal{C}}^\bullet(\mathcal{U}_B, \mathcal{F}_B) = \check{\mathcal{C}}^\bullet(\mathcal{U}, \mathcal{F}) \otimes_A B $$ as follows from Lemma \ref{lemma-affine-base-change}. Since $A \to B$ is flat, the same thing remains true on taking cohomology. \medskip\noindent In case $X$ is quasi-separated, choose an affine open covering $\mathcal{U} : X = U_1 \cup \ldots \cup U_t$. We will use the {\v C}ech-to-cohomology spectral sequence Cohomology, Lemma \ref{cohomology-lemma-cech-spectral-sequence}. The reader who wishes to avoid this spectral sequence can use Mayer-Vietoris and induction on $t$ as in the proof of Lemma \ref{lemma-quasi-coherence-higher-direct-images}. The spectral sequence has $E_2$-page $E_2^{p, q} = \check{H}^p(\mathcal{U}, \underline{H}^q(\mathcal{F}))$ and converges to $H^{p + q}(X, \mathcal{F})$. Similarly, we have a spectral sequence with $E_2$-page $E_2^{p, q} = \check{H}^p(\mathcal{U}_B, \underline{H}^q(\mathcal{F}_B))$ which converges to $H^{p + q}(X_B, \mathcal{F}_B)$. Since the intersections $U_{i_0 \ldots i_p}$ are quasi-compact and separated, the result of the second paragraph of the proof gives $\check{H}^p(\mathcal{U}_B, \underline{H}^q(\mathcal{F}_B)) = \check{H}^p(\mathcal{U}, \underline{H}^q(\mathcal{F})) \otimes_A B$. Using that $A \to B$ is flat we conclude that $H^i(X, \mathcal{F}) \otimes_A B \to H^i(X_B, \mathcal{F}_B)$ is an isomorphism for all $i$ and we win.