Our business in the diagnostics and clinical market declined 4%. While we delivered low double-digit growth in our pathology-related businesses, it was more than offset by continued weakness in genomics. The academia and government market was down low single digits with strength in the Americas driven by government funding offset by weakness in China and Europe. Results were pressured across all geographies in the quarter. As Mike mentioned, China was down 31% year-on-year after growing 44% in Q4 of last year, in line with our expectations coming into the quarter. The rest of Asia was down mid-single digits and both the Americas and Europe declined low single digits in the quarter. Before turning to the rest of the P&L, I’d like to quickly summarize some full year highlights by end market and geography.
From an end market perspective, all markets grew low to mid-single digits for the year except for pharma, which was down 2% globally. In addition, all geographies grew, except China which was down 5%. Back to the P&L for the quarter. Despite the revenue declines, our team continues to execute at a very high level. Fourth quarter gross margin was 55.8%, and our operating margin was a healthy 27.8% in Q4, which was slightly better than our internal expectations. Below the line, we benefitted from stronger than expected cash flow generating incremental interest income in the quarter. Our tax rate was 13.75% and we had 293 million diluted shares outstanding, both as expected. Putting it all together, earnings per share were $1.38 for the quarter, exceeding our expectations, albeit down 10% from a year ago when EPS grew 26%.
As Mike mentioned, our Q4 results capped a year where we grew 1.5% core on the topline, increased operating margins by 30 basis points and grew EPS by 4%, while overcoming a couple of points of currency headwinds. This is a real statement on the team’s ability to quickly adapt to market changes while still delivering leveraged earnings growth. Turning to cash flow and the balance sheet, I’m incredibly proud of the Agilent team as Q4 continued a string of very strong quarterly cash flow results. In Q4, we generated operating cash flow of $516 million, well over 100% of adjusted net income, and invested $84 million in capital expenditures. CapEx spending is driven by our ongoing NASD capacity expansion, which remains on track. For the year, we delivered $1.5 billion in free cash flow, an increase of 44% over last year.
Our balance sheet continues to remain healthy as we end the fiscal year with a net leverage ratio of 0.6 times. With the current challenges in the market, it is great to be a company with a fortress balance sheet and strong cash flow. In the quarter, we paid out $66 million in dividends and spent $80 million to repurchase shares. And for the year, we returned $840 million to shareholders through $265 million in dividends and $575 million in share repurchases. Looking forward, you may have also seen that we recently announced a 5% increase in our quarterly dividend providing another source of value to our shareholders. It’s worth noting that we have increased our dividend every year since we first began issuing them in 2012. Now, let’s move on to our outlook for the upcoming fiscal year and first quarter.
As Mike stated, we expect to see a slow but steady recovery throughout fiscal 2024. However, we also acknowledge the continued market uncertainty, high interest rates, volatile exchange rates and depressed capital spending. Like several of our peers, we expect the markets to be down slightly for the year, while we expect to perform better. Given the expected slower market conditions, we have taken additional steps to adjust our cost structure. Incorporated into our guidance is roughly $175 million of cost savings. Given the significance, I want to provide a little more detail on these actions. Roughly 30% of the savings are related to portfolio optimization decisions we have taken in DGG, the largest of which was the exit of the Resolution Biosciences business.
Another 25% is related to materials and logistics cost savings as well as optimizing our real estate footprint, with the remaining savings tied to continued reductions in discretionary spend and optimizing our workforce. Along with these actions, we have taken a $46 million charge for restructuring and other related costs in our Q4 GAAP results. These reductions, while difficult, are necessary to ensure we continue to fund our most critical investments as well as fund the variable compensation resets from this year. These actions help ensure the company delivers leveraged earnings growth in FY24 and will enable us to emerge even stronger when our markets inevitably return to their long-term growth rates. As Mike noted earlier, we exited Q4 with some potential signs of stabilization with a book to bill ratio of 1 for the company and greater than 1 for LSAG instruments.