How is the change in Gibb's free energy a condition for spontaneity for reactions not happening under constant pressure conditions? According to what I have studied, the change in Gibb's free energy is only a condition for spontaneity for processes happening at constant pressure and temperature conditions.

Consider a reversible reaction happening in a closed vessel at a constant temperature.
We check the feasibility of the reaction at any instant using the following equation:

$\Delta G = \Delta G^{.} + RT\ln(Q)  $

As the reaction happens, the partial pressures of each gaseous component will keep on changing as well as the total pressure. Then how can we use Gibb's free energy for checking spontaneity?
Gibbs energy have an another equation which is:-


So according to this equation spontaneity of a reaction depends both on the enthalpy change as well as entropy change.
We all know that a system attains stability as the system's energy is lowered that is it has to release energy. If in a reaction energy is released enthalpy change is negative.
We also know that a reaction is favoured in the direction of increased chaos or a positive entropy change.

So from this we can see that Enthalpy change is negative and entropy change is positive for a spontaneous reaction to take place and the overall equation of 

becomes negative that is Gibbs free energy must always be negative for a spontaneous reaction.....Can be applied to any reactions.
Hope this helps.