In this paper, we consider the quasilinear elliptic problem with potential (P) − div (φ (x , | ∇ u |) ∇ u) + V (x) | u | q (x) − 2 u = f (x , u) in Ω , u = 0 on ∂ Ω , where Ω is a smooth bounded domain in R N ( N ≥ 2), V is a given function in a generalized Lebesgue space L s (x) (Ω) , and f (x , u) is a Carathéodory function satisfying suitable growth conditions. Using variational arguments, we study the existence of weak solutions for (P) in the framework of Musielak–Sobolev spaces. The main difficulty here is that the nonlinearity f (x , u) considered does not satisfy the well-known Ambrosetti–Rabinowitz condition. [ABSTRACT FROM AUTHOR]