Pick $x \in Z$. To prove (1) suffices to find an open neighbourhood $U \subset X$ of $x$ such that $U \to S$ is flat. Hence the lemma reduces to the case that $X = \Spec(B)$ and $S = \Spec(A)$ are affine and that $Z$ is given by an $H_1$-regular sequence $f_1, \ldots, f_r \in B$. By assumption $B$ is a finitely presented $A$-algebra and $B/(f_1, \ldots, f_r)B$ is a flat $A$-algebra. We are going to use absolute Noetherian approximation. \medskip\noindent Write $B = A[x_1, \ldots, x_n]/(g_1, \ldots, g_m)$. Assume $f_i$ is the image of $f_i' \in A[x_1, \ldots, x_n]$. Choose a finite type $\mathbf{Z}$-subalgebra $A_0 \subset A$ such that all the coefficients of the polynomials $f_1', \ldots, f_r', g_1, \ldots, g_m$ are in $A_0$. We set $B_0 = A_0[x_1, \ldots, x_n]/(g_1, \ldots, g_m)$ and we denote $f_{i, 0}$ the image of $f_i'$ in $B_0$. Then $B = B_0 \otimes_{A_0} A$ and $$ B/(f_1, \ldots, f_r) = B_0/(f_{0, 1}, \ldots, f_{0, r}) \otimes_{A_0} A. $$ By Algebra, Lemma \ref{algebra-lemma-flat-finite-presentation-limit-flat} we may, after enlarging $A_0$, assume that $B_0/(f_{0, 1}, \ldots, f_{0, r})$ is flat over $A_0$. It may not be the case at this point that the Koszul cohomology group $H_1(K_\bullet(B_0, f_{0, 1}, \ldots, f_{0, r}))$ is zero. On the other hand, as $B_0$ is Noetherian, it is a finitely generated $B_0$-module. Let $\xi_1, \ldots, \xi_n \in H_1(K_\bullet(B_0, f_{0, 1}, \ldots, f_{0, r}))$ be generators. Let $A_0 \subset A_1 \subset A$ be a larger finite type $\mathbf{Z}$-subalgebra of $A$. Denote $f_{1, i}$ the image of $f_{0, i}$ in $B_1 = B_0 \otimes_{A_0} A_1$. By More on Algebra, Lemma \ref{more-algebra-lemma-base-change-H1-regular} the map $$ H_1(K_\bullet(B_0, f_{0, 1}, \ldots, f_{0, r})) \otimes_{A_0} A_1 \longrightarrow H_1(K_\bullet(B_1, f_{1, 1}, \ldots, f_{1, r})) $$ is surjective. Furthermore, it is clear that the colimit (over all choices of $A_1$ as above) of the complexes $K_\bullet(B_1, f_{1, 1}, \ldots, f_{1, r})$ is the complex $K_\bullet(B, f_1, \ldots, f_r)$ which is acyclic in degree $1$. Hence $$ \colim_{A_0 \subset A_1 \subset A} H_1(K_\bullet(B_1, f_{1, 1}, \ldots, f_{1, r})) = 0 $$ by Algebra, Lemma \ref{algebra-lemma-directed-colimit-exact}. Thus we can find a choice of $A_1$ such that $\xi_1, \ldots, \xi_n$ all map to zero in $H_1(K_\bullet(B_1, f_{1, 1}, \ldots, f_{1, r}))$. In other words, the Koszul cohomology group $H_1(K_\bullet(B_1, f_{1, 1}, \ldots, f_{1, r}))$ is zero. \medskip\noindent Consider the morphism of affine schemes $X_1 \to S_1$ equal to $\Spec$ of the ring map $A_1 \to B_1$ and $Z_1 = \Spec(B_1/(f_{1, 1}, \ldots, f_{1, r}))$. Since $B = B_1 \otimes_{A_1} A$, i.e., $X = X_1 \times_{S_1} S$, and similarly $Z = Z_1 \times_S S_1$, it now suffices to prove (1) for $X_1 \to S_1$ and the relative $H_1$-regular immersion $Z_1 \to X_1$, see Morphisms, Lemma \ref{morphisms-lemma-base-change-module-flat}. Hence we have reduced to the case where $X \to S$ is a finite type morphism of Noetherian schemes. In this case we know that $X \to S$ is flat at every point of $Z$ by Lemma \ref{lemma-quasi-regular-immersion-flat-at-x}. Combined with the fact that the flat locus is open in this case, see Algebra, Theorem \ref{algebra-theorem-openness-flatness} we see that (1) holds. Part (2) then follows from an application of Lemma \ref{lemma-relative-regular-immersion-flat-in-neighbourhood}.