Magnetic course is to be used in determining the cruise altitude.
From 14 CFR 91.159, "VFR cruising altitude or flight level":
Except while holding in a holding pattern of 2 minutes or less, or
while turning, each person operating an aircraft under VFR in level
cruising flight more than 3,000 feet above the surface shall maintain
the appropriate altitude or flight level prescribed below, unless
otherwise authorized by ATC:
(a) When operating below 18,000 feet MSL and—
(1) On a magnetic course of zero degrees through 179 degrees, any odd
thousand foot MSL altitude + 500 feet (such as 3,500, 5,500, or
7,500); or
(2) On a magnetic course of 180 degrees through 359 degrees, any even
thousand foot MSL altitude + 500 feet (such as 4,500, 6,500, or
8,500).
The same is true for IFR flight: magnetic course determines IFR cruising altitudes. See 14 CFR 91.179, "IFR cruising altitude or flight level".
This is true under FAA regulations. ICAO regulations are similar, but reference magnetic track rather than magnetic course; for these purposes the two terms have the same meaning.