Yes, as long as you get the right battery so that it is an identical fit. Either get a BMW battery, or an Interstate MPT-H6. You will have to plug one of the vents on the interstate battery, and use the vent hose from your original BMW battery.
In the trunk.
When do you need to change a timing chain on a z4 2.2
the battery is in the trunk under the trunk floor mat
Try the battery.
The BMW z4 replaced the BMW z3 in late 2002. The BMW z3 was introduced in 1996 shortly after staring in a James Bond movie. Not as easy on the eyes as the z3 but just as nice.
Go to links below and download instruction. http://www.allergybegone.com/bmw-z4-cabin-air-filter.html
In the trunk, below the trunk floor. The trunk floor is a panel that lifts out to access the battery.
The 2012 BMW Z4 has 16 valves.
The 2005 BMW Z4 has 24 valves.
The 2009 BMW Z4 has 24 valves.
The 2008 BMW Z4 has 24 valves.
The 2011 BMW Z4 has 24 valves.