Feng and Huang [Variational principle for weighted topological pressure. J. Math. Pures Appl. (9) 106 (2016), 411–452] introduced weighted topological entropy and pressure for factor maps between dynamical systems and established its variational principle. Tsukamoto [New approach to weighted topological entropy and pressure. Ergod. Th. & Dynam. Sys. 43 (2023), 1004–1034] redefined those invariants quite differently for the simplest case and showed via the variational principle that the two definitions coincide. We generalize Tsukamoto’s approach, redefine the weighted topological entropy and pressure for higher dimensions, and prove the variational principle. Our result allows for an elementary calculation of the Hausdorff dimension of affine-invariant sets such as self-affine sponges and certain sofic sets that reside in Euclidean space of arbitrary dimension.