החוק השני של התרמודינמיקה מגדיר כי בכל התהליכים הספונטניים, אנטרופיית היקום, סכום האנטרופיה של המערכת והאנטרופיה של הסביבה, גדלה. בעוד שאת האנטרופיה של המערכת ניתן לחשב על פי אנטרופיות מולריות סטנדרטיות, את אנטרופיית הסביבה קשה יותר למדוד או לחשב. לכן, ג’יי וילארד גיבס הגדיר פונקציה תרמודינמית חדשה, המאפשרת לחשב ספונטניות באמצעות האנטרופיה והאנתלפיה של המערכת בלבד, ולא של סביבתה.הזכרו שבתנאי לחץ וטמפרטורה קבועים, דלתא S של הסביבה שווה למינוס דלתא H של המערכת חלקי הטמפרטורה, T.את אגף זה ניתן להציב במשוואה המייצגת את החוק השני. כששני האגפים מוכפלים במינוס T, וכעת המשוואה מראה כי מינוס T כפול דלתא S של היקום שווה לדלתא H של המערכת פחות T כפול דלתא S של המערכת. הפונקציות התרמודינמיות בצד ימין של המשוואה, אנתלפיה ואנטרופיה, תלויות לחלוטין במערכת.משום שגם אנתלפיה וגם אנטרופיה הן פונקציות מצב, ניתן להגדיר פונקציית מצב חדשה כמינוס T כפול אנטרופיית היקום. משוואה חדשה זו נקראת האנרגיה החופשית של גיבס ומסמנים אותה באמצעות האות G.המשוואה לחישוב דלתא G מובילה אותנו לקריטריון חדש לתגובות ספונטניות. ההפרש בין השינוי באנטלפיה לטמפרטורה שהאנטרופיה שינתה, חייב להיות קטן מאפס.דלתא G מכונה גם פוטנציאל כימי בשל הדמיון בינה לבין אנרגיה פוטנציאלית מכנית של מערכת. בדיוק כמו שכדור תמיד יתגלגל במורד המדרון כדי להקטין את האנרגיה הפוטנציאלית שלו, תגובה כימית מתרחשת כדי להקטין את הפוטנציאל הכימי שלה. וכך, בטמפרטורה ובלחץ קבועים, אם האנרגיה החופשית של המערכת פוחתת, כלומר אם דלתא G קטן מאפס, התגובה היא ספונטנית.ולהפך, אם האנרגיה החופשית של מערכת גדלה, דלתא G גדול יותר מאפס, ואז התגובה אינה ספונטנית. אם דלתא G שווה לאפס, אז המגיבים והתוצרים מצויים בשיווי משקל.