The relationship is: $\Delta G = - T \Delta S_{univ} $
Also, if you want to consider electrolysis in this context, your system needs to include the power input in some form. Your entropy increase from obtaining that power is large enough to offset the entropy penalty of an unfavorable process making it spontaneous.